Map Social Post Tags Script

Tags associated with social posts in Social Cloud can be sent to Fusion Service.

These tags aren't displayed in the application, but can be used in Groovy scripts. This script maps social post labels in Social Cloud to social post tags in Fusion Service. Agents can use these tags to take appropriate actions on the SR.

For example, use the following code to set the SR severity to SEV1 when the social post is tagged as urgent:

// do nothing if there are no channel vias
if (!channelCommunication.hasNext())   { 
   return; 
}

// use the first channel via
def channelVia = channelCommunication.next();

// do nothing if the channel via is not a social channel type
if (channelVia.ChannelTypeCd != 'ORA_SVC_SOCIAL')   { 
   return; 
}

// using inbound object id as post id, find the social post
def postId = channelVia.InboundObjectId;
def key = key(postId);
def socialPostVO = newView('SocialPostVO');
def socialPosts = socialPostVO.findByKey(key, 1);

// do nothing if the social post is not found
if (socialPosts == null || socialPosts.size() == 0)   { 
   return; 
}

// use the first social post
def socialPost = socialPosts[0];

// iterate over tags on the social post
def socialPostTags = socialPost.SocialPostTags;

while (socialPostTags.hasNext()) {
   def tag = socialPostTags.next();

   // One example: Set the SR Severity to SEV1 if social post is tagged with "urgent"
   if (tag.Tag == 'urgent')   { 
      setAttribute('SeverityCd', 'ORA_SVC_SEV1'); break; 
   }
}