Hi All,
As a requirement i have to create sales order through batch if the order for related agreement is not available. For this i have wrote the below error where i am getting app.ttsLevel == 0 error.
Although I am using ttsbegin and commit in my code but when it’s going to Sales Table Insert there the value is getting null and the below piece of code through this error . Same code in working fine for Runnable class but when writing it in a click or other class through error.
Here is my code.
while select CRMSalesOrderCreationStaging
{
Info(strFmt("%1",appl.ttsLevel()));
agreementNum = CRMSalesOrderCreationStaging.CRMAgreementNumber;
if(!Salestable::findCRMAgreement(agreementNum))
{
salesTable.SalesId = ‘SO-’+agreementNum;
salesTable.initValue();
salesTable.CRMAgreementNumber = agreementNum;
salesTable.CustAccount = CRMSalesOrderCreationStaging.CustAccount;
salesTable.initFromCustTable();
ttsbegin;
salesTable.insert();
info(strFmt(“Created SalesOrder %1”, salesTable.SalesId));
ttscommit;
}
else
{
info("Update Sales Order Number ");
}
}