Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Remote System Reference" field syntax - 2 custom field required if another custom field is not empty

Mayur Ingale May 13, 2019

If 'SF Connection Case Reference' is not empty then both fields should be mandatory only upon resolution (in resolved and done state).

'SF Connection Case Reference' field type is Remote System Reference. and other 2 fields are a select list.

I want to add Scripted Validator to achieve this. Can you please help us with the code to configure this.

I want to implement this on Resolve transition Workflow validator...

I have tested below Behavior script but it is not working as expected.

-----------------------------------------------------------
def cf = getFieldByName("SF Test Connection Case Reference").getValue()
def cf1 = getFieldByName("Quality of Escalation")
def cf2= getFieldByName("Shortcut opportunity")

log.error("cfremote : " + cf)
log.error("cf : " + cf.getClass())

//def cfValue = cf.getValue()
if (cf != "")
{
cf1.setRequired(true)
cf2.setRequired(true)
}
else {
cf1.setRequired(false)
cf2.setRequired(false)
} 
-----------------------------------------------------------

It's not able to validate the 'SF Test Connection Case Reference' (field type - Remote System Reference).

1 answer

0 votes
Marc Minten (EVS)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 14, 2019

What is in the logs ? (what is class type and contents of cf ?)

What is "...not working as expected..." ?

Suggest an answer

Log in or Sign up to answer