We have a web app from which we can send out alerts and while creating such alerts we can add something called Custom Variables, let say I use this app to send Salary credited message to my employees so I will need a template of this message to avoid creating a message everytime I can use that template in that I will add the standard details like company names and everything but the salary will differ from emp to emp so I'll add a custom variable there like {Salary} so that I can fill that out while sending out the alert.
The issue is when we delete the customer variable from the body it should allow me to just save not save as Template since it is not a template if there is no custom variables
So I'm trying to read the alertDetails property I can update that boloean value in the belwo "istemplate" place to get the desired outcome
Filename:CreateAlertTemplate
<CreateAlertSaveAsButton (this components has been called from the other file) disabled={isSaveAlertDisabled} isTemplate={containsVariables(alertDetails)} onSave={handleSave} onSaveAsDraft={handleSaveAsDraft} onSaveAsTemplate={handleSaveAsTemplateOpen} /> )}
Filename:CreateAlertSaveAsButton
{!isTemplate && ( )} {isTemplate && ( )}The alertDetails.Variables is an Array that records CustomVariables but it records as soon as a custom variable is created but it should only record if a custom variable is inserted into the body and it should delete the entry as soon as we erase the custom variable off the body.


