AnsweredAssumed Answered

Script Trigger in portal Help - Utility Script for basic audit log/notify module

Question asked by ericjlindholm on Mar 14, 2017
Latest reply on Mar 15, 2017 by ericjlindholm

I am working on a utility script for a schedule module.  I am trying to be very conscious of keeping the records locked as little as possible and creating a smooth user experience.  my users are used to making and dropdown selection and the menu closing and committing as soon as the selection is made.

 

When i trigger the script OnObjectValidate on a text field, it captures the current log message and works perfectly.

When i trigger it OnObjectModify for a Popover/Dropdown or boolean toggle, it captures the previous data in the for the log message.  If i add a commit step, it puts all the log data in the portal rows audit log.

 

Im sure my lack of comprehension of exactly how triggers interact is hindering me.  Is there a good way to make this smooth for both text fields and pop up menus / boolean toggles within portals?

 

 

It gets fed a list of parameters that include

 

List(

  GetFieldName( targeted log field) ;

  " message to be logged with  " & example::fieldToBeCaptured ;

  GetFieldName( IdList_notifyTriggField1 ) ;

  GetFieldName( IdList_notifyTriggField2  )

)

 

 

Set Variable [ $logField; Value:GetValue ( Get ( ScriptParameter ) ; 1 ) ]
Set Variable [ $logMessage; Value:GetValue ( Get ( ScriptParameter ) ; 2 ) ]

Set Variable [ $NotifField1; Value:GetValue ( Get ( ScriptParameter ) ; 3 ) ]

Set Variable [ $NotifField2; Value:GetValue ( Get ( ScriptParameter ) ; 4 ) ]

Set Variable [ $NotifField3; Value:GetValue ( Get ( ScriptParameter ) ; 5 ) ]

 

 

Set Field By Name [ $logField; Get ( CurrentTimestamp ) & " " & Get ( AccountName ) & " " &$logMessage & ¶ &GetField ( $logField ) ]

 

If [ Day::date < (Get ( CurrentDate ) + 7 ) ]

  Set Field By Name [ $NotifField1; List( Day_LaborAcceptedList::id) ]

  Set Field By Name [ $NotifField2; List( Day_LaborAcceptedList::id) ]

  Set Field By Name [ $NotifField3; List( Day_LaborAcceptedList::id) ]

End If

 

Commit Records/Requests [ No dialog ]

Go to Field[ ]

End If

 

Example parameters:

List(

  GetFieldName( Schedule::auditLog ) ;

  "set the location to " &  Schedule_Venue::Name ;

  GetFieldName( Schedule::idList_notifyAll ) ;

  GetFieldName( Schedule::idList_notifyVenue  )

)

Outcomes