I have a variable called "Request type" that has two choices: "New_card_production" and "Modify_card." I also have a "Delivery date" variable. If the user selects "New_card_production," then the user should be forced to enter a date that is 180 days or more from the current date. If the user selects "Modify_card," then the user must enter a date that is 30 days or more from the current date. I have tried UI Policy and different client scripts/script include but nothing seems to work. Can you please share with me a working code or the best method to implement this?
while selecting the onchange and onload ,onsubmit,oncelledit am unable to get a script function in script field(default function) . what will be the solution can you please suggest.
// Use case : Polulate assignment group "Yardi - ABF" if the the CI is "Yardi - ABF" function onChange(control, oldValue, newValue, isLoading, isTemplate) { if (isLoading || newValue === '') { return; } var ref = g_form.getReference('cmdb_ci'); if (newValue == 'Yardi - ABF'){ g_form.setValue('assignmnet_group','Yardi - ABF'); } } i have written this script but isnt functioning well
this is either bcoz of u r using the same value to set which is used in the if condition or bcoz the backend value is incorrect. please do let me know what was the issue if u got this resolved.
Sir if i change the value from New to On Hold it works but if i again select other state like new or in progress, its still mandatory that's what i do not want , can u tell the code to avoid that. Thanks in Advance :)
Awesome 👍👍👍👍
Thank for your sharing!
I have a variable called "Request type" that has two choices: "New_card_production" and "Modify_card." I also have a "Delivery date" variable. If the user selects "New_card_production," then the user should be forced to enter a date that is 180 days or more from the current date. If the user selects "Modify_card," then the user must enter a date that is 30 days or more from the current date.
I have tried UI Policy and different client scripts/script include but nothing seems to work.
Can you please share with me a working code or the best method to implement this?
while selecting the onchange and onload ,onsubmit,oncelledit am unable to get a script function in script field(default function) . what will be the solution can you please suggest.
Thanks for this !
My pleasure!
Thanks.. ❤️
What is Isolate script in client scripts.Can you pls explain
// Use case : Polulate assignment group "Yardi - ABF" if the the CI is "Yardi - ABF"
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var ref = g_form.getReference('cmdb_ci');
if (newValue == 'Yardi - ABF'){
g_form.setValue('assignmnet_group','Yardi - ABF');
}
}
i have written this script but isnt functioning well
this is either bcoz of u r using the same value to set which is used in the if condition or bcoz the backend value is incorrect. please do let me know what was the issue if u got this resolved.
Not the ideal use case for new record when changing the category
Sir if i change the value from New to On Hold it works but if i again select other state like new or in progress, its still mandatory that's what i do not want , can u tell the code to avoid that. Thanks in Advance :)
Same problem, can we rollback the worknotes field if we change the state to anyother field except onhold? Did u get the solution?
@@gayathriadoni7faced the same issue as well and felt like might be an glitch in PDI
Add an else condition with setMandatory of worknotes to false. It works
if (newValue == '3') {
g_form.setMandatory('work_notes', true); }
else {
g_form.setMandatory('work_notes', false);
}
@@gayathriadoni7