Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

To direct workflow on the basis of entitlement date difference

NM
Valued Contributor
Valued Contributor

Hi Team,

we have a use case in which if difference between entitlement start date and enddate is greater than 3 months it should flow to xyz person for approval otherwise to Usergroup, please let me know how can i compare the dates and accomplish this.

Tried (Didn't work)

If else block, Language groovy selected

Statement - (com.saviynt.ecm.workflow.Request_Access.get(new Long(requestaccesskey)).enddate.format('MM').toInteger()-com.saviynt.ecm.workflow.Request_Access.get(new Long(requestaccesskey)).startdate.format('MM').toInteger())>2

Thanks

10 REPLIES 10

Saathvik
All-Star
All-Star

@NM : Where did you place this block in WF? Can you share the WF screenshot please? Also if there is any issue please share the respective logs


Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.

NM
Valued Contributor
Valued Contributor

Hi @Saathvik , Workflow screenshot below(Created a test workflow approval might be different from what mentioned above)

NM_0-1715883117884.png

Error in log

NM_1-1715883152112.png

Please advice

@NM :  Try below logic

((com.saviynt.ecm.workflow.Request_Access.get(new Long(requestaccesskey)).enddate.format('M').toInteger())-(com.saviynt.ecm.workflow.Request_Access.get(new Long(requestaccesskey)).startdate.format('M').toInteger()))>2

 


Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.

NM
Valued Contributor
Valued Contributor

@Saathvik , instead of just comparing months we have to compare dates too so if request is submitted on 25 May and end date is 30th July it should fall under greater than 2 months.

@NM : Then try below

(com.saviynt.ecm.workflow.Request_Access.get(new Long(requestaccesskey)).enddate - com.saviynt.ecm.workflow.Request_Access.get(new Long(requestaccesskey)).startdate)>60

Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.

NM
Valued Contributor
Valued Contributor

Hi @Saathvik , Thanks for the response,

Tried got the same error in groovy language it automatically converts the sign to >

NM_0-1715916940957.png

Export workflow change condition and reimport workflow


Regards,
Rushikesh Vartak
If you find this response useful, kindly consider selecting 'Accept As Solution' and clicking on the 'Kudos' button.

@NM : It looks like a bug automatically converting into html code in UI itself after saving. I would suggest to report to Saviynt support to confirm the same. Meanwhile you can try workaround Rushi suggested to see if that works. 


Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.

NM
Valued Contributor
Valued Contributor

@rushikeshvartak If i convert the Workflow into XML in UI will that work?

if not what do you mean export change condition should i export the workflow before changing the condition and add the new condition in XML and reupload?

  • Transport - Export - Workflow 
  • Unzip file 
  • Change WF condition in .wf file
  • zip file
  • Transport Import 

Regards,
Rushikesh Vartak
If you find this response useful, kindly consider selecting 'Accept As Solution' and clicking on the 'Kudos' button.