- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 09:57 AM
Hi Team, could you please assist here:
If the 'requested for' and 'site owner' variable's values don't match, then display a mandatory upload button with 'xyz' text?
here both the variables refers to user table.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2024 01:46 AM
Hi @Bindhu1 ,
Before submitting the catalog item request will not be created so what you can do is You can compare with logged in user and site owner because Request table Request for hold the logged in user value,
I have changed the client script please have a look,
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
g_form.setDisplay('attachment',false);
return;
}
var requestedFor = g_user.userID;
// alert('Requested for' + requestedFor);
// alert('new Value'+ newValue);
if(requestedFor != newValue){
g_form.setDisplay('attachment',true);
g_form.setMandatory('attachment',true);
}
else{
g_form.setMandatory('attachment',false);
g_form.setDisplay('attachment',false);
}
//Type appropriate comment here, and begin script below
}
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 11:24 AM
Hi @Bindhu1
Instead of creating a button you can use attachment option in incident table.
By writing business rule before insert or update(based upon your requirements ) we can make attachment mandatory
var currentuser = gs.getUserID();
var caller_id = current.caller_id;
if (currentuser != caller_id) {
if (current.hasAttachments() == true) {
gs.addInfoMessage('There is an attachment');
} else {
gs.addErrorMessage('There is no attachment');
current.setAbortAction(true);
}
}
Thanks and Regards
Sai Venkatesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 01:31 PM - edited 05-08-2024 01:34 PM
Hi @Bindhu1,
You can create an attachment type variable and use a UI Policy to display and mandate the attachment variable when the requested_for and site_owner variables are different.
e.g.
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 02:12 PM
Hi @Bindhu1 ,
You can create a onchange client script and validate whether the requested for and site owner both are same them make attachment mandatory and visible,
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
g_form.setDisplay('attachment',false);//upload button backend name
return;
}
var requestedFor = g_form.getValue('requested_for');//Requested for backend name
if(requestedFor != newValue){ //chceking onchange of site owner which is nothing but newValue
g_form.setDisplay('attachment',true);
g_form.setMandatory('attachment',true);
}
else{
g_form.setMandatory('attachment',false);//upload button backend name
g_form.setDisplay('attachment',false);
}
}
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2024 12:56 AM
Hi @swathisarang98 , thanks for your reply!
Here is a small correction , the 'requested for' is on request table , and 'site owner' is a cat item variable. How to we check in this case, could you please help me here ?