How to populate value in any field using if condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2017 02:30 AM
Can any one help me out in finding the solution to populate value in any field using if condition.
Ex. if sys_id is xxxxxxxxxx, short description should be 'abcd'
if sys_id is yyyyyyyyyy, short description should be 'apple'
I want to check both the condition.
Help is appreciated.
Thanks & Regards,
Ganga Bhavani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2017 10:24 AM
sys_id of what?
Sounds like a simple client scripting problem... but could do with a clearer problem definition before offering up a solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2017 10:26 AM
Hi Ganga,
Two common ways this would be done:
#1 Using a Business Rule
You can use a business rule that runs server side so on the insert or update of the record, you can check the exact conditions you would like.
If the condition is met, you can run a specific action you desire (e.g. set short description to abcd).
#2 Using a Client Script
If you want more real-time changes, meaning as the user fills in the form have it change the value, then you need to use a onChange client script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2017 10:27 AM
Something simple like this is one we use for an "if this or this" statement in a task in a workflow:
if (current.variables.app == 'Xpress Account' || current.variables.app == 'Harland Clarke') {
task.short_description = "ABCD";
}else{
task.short_description = "APPLE";
}
Similar could be done in a client script to set a field on the form equal to something for onLoad, onChange, etc..
if(typeofrequest == 'position_change' || typeofrequest == 'new_hire'){
g_form.setValue('job_function','ABCD');
}else{
g_form.setValue('job_function','Apple');
}
These are just examples of stuff we are using
Please mark this response as correct and/or helpful if it assisted you with your question.
Steven