How to clear the variable value (Empty the variable value) in the workflow using Runscript

sreejith05
Giga Expert

Hi Team,

 

I have requirement where i need to clear two date fields with in the workflow, please let me know how we can achieve this.

Let me give more details on this in my form i have field named Uat_Completion_date which needs to be filled by the requester, but after the request submission in the middle of the workflow i need to clear what ever date (value) we have in the Uat_completion_date field, as i need to make a re entry for that particular field if the UAT fails.

 

find_real_file.png

9 REPLIES 9

This should work, i tried and it did for me.

Can you paste your script?

Did it work for you? 

Can you please mark the correct answer for this post? Not sure why it was unmarked even after responding to multiple queries?

sreejith05
Giga Expert

Thanks Alikutty, thanks for your quick help.

 

Just have one more query is there any script or way we can make attachment mandatory while closing a task?

You can write a before insert/update business rule on your task table with condition as:

State changes to Closed and Script as

   var att = new GlideAggregate('sys_attachment');
   att.addAggregate('COUNT');
   att.addQuery('table_name', current.getTableName());
   att.addQuery('table_sys_id', current.sys_id);
   att.query();
   var count = 0;
   if (att.next()) {
    count = att.getAggregate('COUNT');

   if (count<1) {
    gs.addInfoMessage("Please attach Attachment");
    current.setAbortAction(true);
   }
   }