No update in value if certain string in account customproperty

seemran17
New Contributor II
New Contributor II

Hello,

The usecase is that there should be no change in certain attribute if customproperty is 'noupdate'/ blank

These are the code lines that work:

"department": "${if(task?.accountKey.customproperty10 == '') {user?.departmentname} else {user.departmentname}}"

"department": "${if(task?.accountKey.customproperty10.equalsIgnoreCase('noupdate')) {user.departmentname} else {user?.departmentname}}"

However, they update in both cases. Does anyone know the variable to use if we want the past value to be retained?

(I've tried undefined keyword and saviyntnotchanged keyword already)

Also, on that note, am i wrong in assuming that {user?.departmentname} means latest value and {user.departmentname} is the already present value? Does it not work that way?

Thanks

 

2 REPLIES 2

rushikeshvartak
All-Star
All-Star

saviyntnotchanged Should be capital

Hi,

I tried this: 

"department": "${if(task?.accountKey.customproperty10 == '') {user?.departmentname} else (SAVIYNTNOTCHANGED)}"

but it's giving me error:

Error while Update operation for account-TestThree in AD - No such property: SAVIYNTNOTCHANGED for class: SimpleTemplateScript87

Our version is 2023.2, btw - I figured the keyword should work here. Or should I put in in {} instead of ()?