Examples: ActionStatus_LogError()


The following is the DeleteLeads procedure for the Leads card list defined in the sample integrating application. This procedure is run when the Delete action is performed for the list. If an error occurs during the delete process, the ActionStatus_LogError() function is used to log the error details. Once the action processing is complete, the ActionStatus_LogActionComplete() function is called to complete the process. Since the Delete action can be performed on multiple list items at once, the List_MultiSelectActionCompleteEvent procedure is called to indicate that a multi-select action has finished.

inout ListObjState list_object;

local ListStatusLineUserDefData UserDefData;
local long ErrorsLogged;
local long Sequence;
local integer SuccessCount;
local integer FailureCount;

{Clear the status counts}
SuccessCount = 0;
FailureCount = 0;

{Use the table reference from the list object to find which Leads are selected in the list.}
get first table(list_object:TableRef1) by number list_object:Index;

while err() = OKAY do
	{Attempt to delete the selected Lead}
	'Lead ID' of table IG_Leads_MSTR = 'Lead ID' of table(list_object:TableRef1);
	change table IG_Leads_MSTR;
	if err() = OKAY then
		{Item could be locked, so delete it}
		remove table IG_Leads_MSTR;
		if err() = OKAY then
			increment SuccessCount;
		else
			increment FailureCount;

			{Log the details of the error}
			UserDefData:'User Defined Text01' = 'Lead ID' of table(list_object:TableRef1);
			Sequence = ActionStatus_LogError(list_object:ActionStatusID,
				list_object:'Error Sequence Number',
				"Lead could not be deleted", 
				err(),
				'Lead ID' of table(list_object:TableRef1),
				UserDefData) of form syListObj;

			increment list_object:'Error Sequence Number';
		end if;
	else
		{Item could not be found or passively locked}
		increment FailureCount;

		{Log the details of the error}
		UserDefData:'User Defined Text01' = 'Lead ID' of table(list_object:TableRef1);
		Sequence = ActionStatus_LogError(list_object:ActionStatusID,
			list_object:'Error Sequence Number',
			"Lead could not be found or was already deleted",
			err(),
			'Lead ID' of table(list_object:TableRef1),
			UserDefData) of form syListObj;

		increment list_object:'Error Sequence Number';
	end if;

	{Get the next Lead to delete}
	get next table(list_object:TableRef1) by number list_object:Index;

end while;

{Log the success and failure results}
ErrorsLogged = ActionStatus_LogActionComplete(list_object:ActionStatusID, SuccessCount, FailureCount) of form syListObj;

{Indicate that the mutli-select list action is complete}
call List_MultiSelectActionCompleteEvent of form syListObj, list_object;


Documentation Feedback