- 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-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-09-2024 02:40 AM
@Bindhu1 Thanks for marking my answer as helpful. If it helped you in any way please accept the solution so that it will be beneficial to the future readers with the same query.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2024 03:33 AM - edited 05-09-2024 03:33 AM
Hi @swathisarang98 ,
Thank you for your time.
This solution works perfectly. However, in my scenario, the 'requested for' field, which is editable, is coming from a widget (not from item variable), as shown in the image. The variables marked in blue are the catalog item variables.
So, when a user can change the 'requested for' field, it will be captured in the request table. Therefore, the 'requested for' field is not logged in the user all the time.
I would appreciate any suggestions you have regarding this matter.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2024 04:42 AM
@Bindhu1 If the requested for is coming from Widget then you can not compare the field values from client script you should access the Catalog Form values from widget and check in Widget client side so if you want me to help you in that could you please share the code of HTML, server side and client side of your customised widget,
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 01:54 AM
@Bindhu1
where do you want to show the attachment variable? Is it on catalog item form?
If yes, then do you have the requested for variable in catalog?