Vlocity Facts #33 || Edit Block for Custom Actions in OmniScript

In Previous post we have seen about Edit Block - Default Actions.

An Edit Block element in Omniscript allows the user to create, edit, and delete multiple records. To accomplish this, the edit blocks are repeatable blocks by default. In 3Ways, we can configure the Edit Block.
  • Adding Default Actions
  • Adding Custom Actions
  • Adding Global Actions

Adding Custom Actions 
In Previous example we are trying to update the case description and we followed Default Action [Remote Action - Edit], if there is a requirement when case description is updated we need to update a description field with time on contact object which is related to case and Email should be triggered to the contact owner.

In this scenario generally default actions will not work where we need to update other object fields and to trigger email, we can over come this by using Custom actions in edit block.

We can create custom actions by using

  • Http Action
  • Integration Procedure
  • Remote Action

For this requirement I will use Integration procedure.
Will create Integration Procedure with Dataraptor post action by configure case and contact fields in it.

To map the fields inside DataRaptor Post you can get the json from omniscript by previewing.
Copy the json and map in DataRaptor post.

Now need to configure Email Action in Integration procedure.

Drag and Drop the Email Action from available components. If you have email templates you can use those templates or you can configure email body in email action. [Other post related to Email Action]

Email Address, Email Subject, and Email Body are defined because I'm utilizing the without template option.

Following the creation of the Integration Procedure. We must add it to Edit Block.

Expand the edit block in Omniscript and add the Integration Procedure there. To invoke this Integartion procedure for Edit scenarios in Edit block we need to upend Edit at the end of the Action Name.
To Populate time on Contact object - Description field I'm using one formula [ContactFormula] which CONCAT -- Case Number, Description and Today Date.
CONCATENATE('Case Number',' ',%Number|n%,' ','Description Updated On',' ',DATE(TODAY()))
In this edit block we have to actions
  • Default action[Default Action Edit] which uses remote action to call salesforce standard apex class to update case record.
  • Custom action[Custom Action Edit] which uses Integration Procedure for updating case, contact fields and sends email to Contact Owner.
UI for both buttons will be same but backend process will change based on the button you choose.
Custom Action Edit Page:
Default Action Edit Page:


After Saving the changes by using Custom Action Edit. Contact, Case will be updated with time and description fields.

Contact Owner will receive an email
Like this we can create custom actions for New and Delete the main thing is we need to upend the action name with New or Delete Or Edit based on our scenarios [Example: In this scenario we are using Edit and i upend Edit to my action name as CustomActionEdit].


Comments

Popular posts from this blog

Vlocity Facts #01 | OmniStudio DataRaptors

Vlocity Facts #34 || Getting the details from the URL in a FlexCard and an Omniscript

Vlocity Facts #44 || Communication between Omniscript and Flexcard [Pub/Sub]