Saturday 1 March 2014

How to pass a mapping value of mapping variable to workflow and worklet


Normally we come across various scenarios where have to use value from inside of mapping as session or workflow/worlklet variable.

Two scenarios I can think of 

1.       You have to use sessstarttime in sending attached files by email in email task. You can’t do it normally as sessstart time is not available in email task.

2.       You have a mapping to capture errors in mapping and you want to send error details in email to user with all error details like file name, column name and error code and error description.

It can be achieved in by below

1.       Create a mapping variable for example in second case with name $$FILE_NAME with type max or min and data type string

2.       Assign value to $$FILE_NAME using variable function inside mapping SETVARIABLE($$FILE_NAME,CurrentlyProcessedFileName)



3.       Create two workflow variable with name $$FILE_NAME and $$BLANK

4.       Use Session Pre assignment task to assign a blank value to mapping variable, Reason behind is that if you don’t do this then it will take persistent value from repository and it will compare result from last session to current session and can result in inconsistent output depending on whether you are using max or min function.So at start of session FILE_NAME mapping variable has been assigned a blank value





5.       Use Session Post session assignment (success/ failure) to assign a value to



Workflow Variable FILE_NAME has been assigned value from Mapping Variable FILE_NAME (Which has been assigned value by mapping variable function when session ended) So Workflow Variable FILE_NAME has value which can be used in email task.

6.if you further want to assign value from worklet to workflow then double click on work let inside workflow  and click on variable tab ,you can use it in work let now

You might also want to read article related to behavior of mapping variables wrt to peristent value Behavior of Mapping Variables with persistent values




No comments:

Post a Comment