If requested for and owner field's values don't match then show new variable

Bindhu1
Tera Contributor

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

1 ACCEPTED SOLUTION

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

View solution in original post

12 REPLIES 12

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

@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

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.

 

Bindhu1_0-1715250454832.png

 

 

@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

 

@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?