How to hide attachment in CSM/FSM workspace when case state is close or resolved

SomashekarB
Tera Contributor

I have requirement, in CSM/FSM workspace if the case state is moved to closed or resolved, the attachment icon which is visible side bar of the work space should not be visible.

 

Any quick suggestions?

 

SomashekarB_0-1728923279050.png

 

8 REPLIES 8

Diogo Ramos
Giga Sage

Hello, 

I'm not sure if you already have a customized variant, but if not you need to go to ui builder / experiences / csm fsm workspace / find the record page that is loading (lowest order) and then you might need to duplicate that variant if it says that it is read only. 

Once you have identified your page and created a new variant, you can then add a new data resource, type of lookup multiple records, (I use this instead of single because it gives a better flexibility of handling the filter, and we can just set the max results  to 1 anyway) : 


Make sure you configure the table name, the conditions and the fields to return 

DiogoRamos_8-1728942071031.png

DiogoRamos_9-1728942090537.png

Now you have a data resource that will give you the value of the state for the record that you have open. 

We now go to the tabs to find the attachment tab : 

DiogoRamos_4-1728938930198.png


If you click on the tabs component (1) and then click on the tab option (2), you will see the option to show or hide the tab (#3), which by default uses a client state value that is modified by some other data resources.

 

DiogoRamos_5-1728939082346.png

 

If you click on this hide tab option, you see the following : 

DiogoRamos_6-1728939229061.png

 

Click on the script option, and use the following code, make sure you use your data resource variable name

/**
  * @Param {params} params
  * @Param {api} params.api
  * @Param {TransformApiHelpers} params.helpers
  */
function evaluateProperty({api, helpers}) {
	
  // Get the state value 
  var stateValue = api.data.look_up_multiple_records_1.results[0].state.value;

  // if closed return true to hide
  if (stateValue === "3"){
    return true;
  }
  
// else use with OOB config
  return api.state.hideAttachment;
}


This was tested in Xanadu, should work in other versions as well.


Hope it helps



Robbie
Kilo Patron
Kilo Patron

Hi @SomashekarB,

 

It will be interesting to go through the steps @Diogo Ramos has provided - kudos.

 

Please note that whilst hiding the icon under certain circumstances is the ultimate requirement, rest assured that ACL's are honored at the data layer, so if you have the correct ACLs in place (which are set as you require by default), whilst the icon is visible, it will not be possible to add an attachment despite the icon being visible - not ideal I agree.

 

If you are testing as an admin user, you will see that you can add an attachment, but this is based on admin access, if you impersonate a user without admin access, you will see it is not possible.

 

I do however understand your question and sadly to date, I have not see an easy way without digging into UI Builder as a way to achieve this sadly. Please let me know how you go with @Diogo Ramos' recommendation and steps.

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.



Thanks, Robbie

This is a very valid remark, I jumped straight into a solution, but indeed test the behavior acl wise when a ticket is closed, I think you can prevent adding attachments based on that condition What I'm not sure, is, if you can prevent people from reading attachments when closed (if that is the ultimate goal) , but that could probably be done. And if it's really a data segregation feature you want, make sure to follow it up with the required security rules as @Robbie mentioned.

 

 

Hi @Diogo Ramos Thanks for support! I do follow the steps and navigate to UI builder-->CSM/FSM Configurable workspace--> Record Default and selected the contextual sidebar

1) Selected the view attachment and open in the new window

2) when click the Attachment name, i could not able see the attachment icon and set conditions as per my requirement.

 

Could please guide me as I am new workspace design and builder.

SomashekarB_0-1728988357052.png

SomashekarB_1-1728988416503.png

 

SomashekarB_2-1728988570605.png

SomashekarB_4-1728988774175.png