$event API
$event API is used to retrieve information on how the snippet is invoked and the current record is added/edited.
If we invoke this API from header fields then it will return the current record of header and child lines. If we invoke this method from child line fields then it will return the child line record information.
$event.get(callback_function(response) {
}
);
The response is the result of $event.get request. This response is in JSON format with source and currentRec. The source contains the information on how the snippet is invoked.
The currentRec is the record, that is being currently added or edited before it is available in the $sfm_records.
currentRecIndex, currentRecId, and currentTabIndex are included in $event.get API.
currentRecIndex refers to current record index from section lines which are sorted in ascending order of the created date.
currentRecId refers to current record ID from section lines (Parts or Labor or Travel or Expense).
currentTabIndex refers to section index of the section lines.
Example
For 'on change event' of Datetime field of the work detail (child record), the current record added or edited is available under $event. All other information on that SFM will be available in $sfm_record.
Following is the sample request for $event API:
$event.get(function(rec){});
Following is the sample response for $event API:
{
"source":"Field",
"currentRecIndex" : "1",
"currentSectionId" : "a0fP00000039zqBIAQ",
"currentRec":{"Name":"","SVMXC__Start_Date_and_Time__c":"","SVMXC__End_Date_and_Time__c":"2019-02-07 06:43:00","FSR_Name__c":{"key":null,"value":null}
,"SVMXC__Product__c":{"key":null,"value":null}
,"SVMXC__Activity_Type__c":{"key":"Ser-vice","value":"Service"}
,"SVMXC__Dead_Time__c":null,"SVMXC__Use_Price_From_Pricebook__c":false,"SVMXC__Actual_Quantity2__c":1,"SVMXC__Actual_Price2__c":null,"SVMXC__Covered__c":null,"SVMXC__Work_Description__c":"","SVMXC__Is_Billable__c":true,"SVMXC__Billable_Quantity__c":null,"SVMXC__Billable_Line_Price__c":null,"SVMXC__Group_Member__c":{"key":null,"value":null}
,"IsDeleted":"false","CurrencyIsoCode":null,"SVMXC__Applied_Rate_Type__c":null,"SVMXC__Cost_Category__c":null,"SVMXC__Expense_Type__c":null,"SVMXC__Include_in_Quote__c":"false","SVMXC__Is_Entitlement_Performed__c":"-false","SVMXC__Line_Status__c":"Open","SVMXC__Line_Type__c":"Labor","SVMXC__Log_Against__c":null,"SVMXC__Posted_To_Inventory__c":"false","SVMXC__Received_Country__c":null,"SVMXC__Requested_Country__c":null,"SVMXC__Select__c":"false","Is_Logged_In_FSR__c":"false","Id":"a2A_local_1549521656688_2"}
}
}
Was this helpful?