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

Task Type check for User Update Rule in Create Ticket JSON

Saviynt_Savvy
Regular Contributor
Regular Contributor

Hi all,
I need to create a Ticket in Freshservice application for MOVER scenario.
I need to include all the entitlement details in the ticket description.

MOVER Scenario:
When the user department is updated all the account entitlements should be removed and new entitlements should be added.

I have configured,
User Update rule: Deprovision Access (Only Access) AND Re-run selected Technical Rules.
Technical rule :      Assign Entitlements.

The below screenshot defines the
tasktypes (1=Add Access, 2=Remove Access) and task sources (PROVRULE/ZERODAY) of the tasks that were generated for the MOVER scenario.

Saviynt_Savvy_0-1713430520084.png

Based on the tasktype and source, I am creating the ticket's Subject & Description.
I am using the below CREATETICKETJSON to create the ticket, but I fail to create the ticket for the MOVER scenario.

CREATETICKETJSON:
{
"call": [
{
"name": "call1",
"connection": "acctAuth",
"url": "https://xxxxxxx.freshservice.com/api/v2/tickets",
"httpMethod": "POST",
"httpParams": "{\"subject\":\"${(task.tasktype==3 && task.source=='ZERODAY') ? 'Onboard - Add Account Ticket : ':(task.tasktype==14 && task.source=='PROVRULE') ? 'Offboard - Disable Account Ticket: ':((task.tasktype==2 && task.source=='PROVRULE') || (task.tasktype==1 && task.source=='ZERODAY')):'Mover Ticket:':''}\",\"email\":\"xxxxxxxx@xxxxxx.com\",\"description\":\"${(task.tasktype==3 && task.source=='ZERODAY') ? 'The below user is Onboarded: (task.tasktype==14 && task.source=='PROVRULE') ? 'The below user is Offboarded':((task.tasktype==2 && task.source=='PROVRULE') || (task.tasktype==1 && task.source=='ZERODAY')) ? 'Update the below user Account & Access':''}<div><strong>Requested Entilements:</strong> ${allEntitlementsValues.replace('ADD :: ','').replace('REMOVE :: ','').replace('\n','').replace('(','').replace(')','')},\"priority\": 1, \"status\": 2}",
"httpHeaders": {
"contentType": "application/json",
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"ticketidPath": "ticket.id",
"unsuccessResponses": {
"message": "Failed"
}
}
]
}

I assume that because of the all the tasks were generated at the same time for a single userupdate rule it is failing to check the task.tasktype and task.source condition checks.

Please let me know how can I check the conditions and create the ticket in this MOVER scenario.

Thanks & Regards,
Saviynt Savvy

5 REPLIES 5

rushikeshvartak
All-Star
All-Star

{\"Subject\":\"${if(((task.tasktype==12 || task.tasktype==2) && task.source=='PROVRULE') || (task.tasktype==1 && task.source=='ZERODAY')) ? 'Update User Access':''}}\"


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

Hi @rushikeshvartak , 
I have edited my post and elaborated on my requirements in detail.
Please go through the requirements once and suggest any ideas.

Thanks & Regards,
Saviynt Savvy

What is error you are getting in logs 


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

Manu269
All-Star
All-Star

@Saviynt_Savvy refer a sample below which I am using for SNOW :

Short description attribute :

 

{\"short_description\":\"${if(task.source=='PROVRULE' && task?.tasktype==14){'[NO ACTION REQUIRED]:'} else if(task.tasktype==14){'[NO ACTION REQUIRED]:'} else if(task.requestKey?.requesttype==3 || task.requestKey?.requesttype==11 && task.tasktype==3){''}else if(task.tasktype==2 && (allEntitlementsValues==null || allEntitlementsValues.isEmpty() || allEntitlementsValues=='')){''}else if(task.source=='PROVRULE' && task?.tasktype==2){''}else if(task.tasktype==2){''}else if(task.requestKey?.requesttype != 3 && task?.tasktype==1){''}else if(task.tasktype==6){''}else if(task.tasktype==12){''}else{task.tasktype}} Implementation: ${if(task.requestKey?.requesttype==3 || task.requestKey?.requesttype==11 && task.tasktype==3){'New Account and Grant Access'}else if(task.tasktype==2 && (allEntitlementsValues==null || allEntitlementsValues.isEmpty() || allEntitlementsValues=='')){'Delete Account'}else if(task.source=='PROVRULE' && task?.tasktype==2){'Revoke Access'}else if(task.tasktype==2){'Revoke Access'}else if(task.requestKey?.requesttype != 3 && task?.tasktype==1){'Grant Access'}else if(task.tasktype==6){'Enable Account'}else if(task.tasktype==12){'Update Account'}else if(task.source=='PROVRULE' && task?.tasktype==14){'Disable Account'} else if(task.tasktype==14){'Disable Account'}else{task.tasktype}} for ${user.displayname}
Regards
Manish Kumar
If the response answered your query, please Accept As Solution and Kudos
.

Hi @Manu269  
I have edited my post and elaborated my requirements in detail.
Please go through the requirements once and suggest any ideas.

Thanks & Regards,
Saviynt Savvy