Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

Admins can use Pulsar Settings to implement Validation Rules and Triggers for the following execution points:

...

Note that there is another setting that first needs to be enabled for the user to see the scan barcode icon on a record. (pulsar.layout.enableBarcodeScanner. Refer to that setting on Layout Detail View Controller Settings).

 

Code Block
DEFAULT{ 
Action=SetVar; 
VarName=ScanCode; 
VarValue=@@CurrentScanCode; 
| 
Action=SetVar; 
VarName=UserId; 
VarValue=@@CurrentUserId; 
| 
Action=SetVar; 
VarName=CurrentDate; 
VarValue=@@Today; 
| 
Action=SqlQuery; 
QueryString=select (CASE WHEN length('%%ScanCode%%') = 0 THEN 1 ELSE 0 END) as emptyScanCode; 
QueryReturnFields=emptyScanCode; 
QueryTest=%%emptyScanCode%%=1; 
QueryTestTrue=BARCODE_SCANNER_ERROR; 
| 
Action=SqlQuery; 
QueryString=select Id from Store_Asset__c where Scan_Code__c = '%%ScanCode%%' LIMIT 1; 
QueryReturnFields=@@QueryCount, Id AS AssetId; 
QueryTest=%%QueryCount%%<=0; 
QueryTestTrue=ASSET_NOT_FOUND; 
| 
Action=CreateAndMapFields; 
ObjectType=Task; 
ActionShouldComplete=TRUE; 
ActionShouldDisplay=FALSE; 
OwnerId=%%UserId%%; 
WhatId=%%AssetId%%; 
Status="Completed"; 
Subject="Post Call Auto Create"; 
ActivityDate=%%CurrentDate%%; 
| 
Action=Alert; 
Message="Successfully logged the asset"; 
AlertType=DismissCurrentWindow; 
} 

ASSET_NOT_FOUND{ 
Action=Alert; 
Message=No Asset matching %%ScanCode%% is found in the database; 
} 

BARCODE_SCANNER_ERROR{ 
Action=Alert; 
Message=Please point the camera at the code and wait for the scanner to display the number; 
}