0 votes

Hello,

I have created a new entity named PAIEMENTS. I have added custom fields in the relation PAIE_DOCU.

As function AfterCommitOppoProd(oppoProdCxt, Inserted) works, I thought that « AfterCommitPaieDocu would work..... But, the folowing Commit operation doesn't work:

function AfterCommitPaieDocu(PaieDocuCxt, Inserted) {
var PaieDocuDS = Database.GetMasterDataset(PaieDocuCxt, 0);
var PaieKey = PaieDocuDS.FieldByName('K_PAIEMENT').AsFloat;
var DocuKey = PaieDocuDS.FieldByName('K_DOCUMENT').AsFloat;
var APayer = PaieDocuDS.FieldByName('F_A_PAYER').AsFloat;
var Paye = PaieDocuDS.FieldByName('F_PAYE').AsFloat;
var Ecart = PaieDocuDS.FieldByName('F_ECART').AsFloat;
var TotalPaye = Paye + Ecart;
PaieDocuDS.FieldByName('F_ENCAISSEMENT_VALIDE').AsInteger = 1;
Efficy.DisableWorkflow = true;
Efficy.CommitChanges(PaieDocuCxt, false);
Efficy.DisableWorkflow = false;
}

Do you know the reason?

The following command works:

function OnInsertDetailPaieDocu(EditHandle, Detail, DetailKey) 

Thank you
Dimitri

asked in Efficy/ Client side by (112 points)
edited by

1 Answer

0 votes

You don't mention it explicitly, but I assume that the AfterCommitPaieDocu event is just not triggered.

That is perfectly normal if the relation between both entities Paie and Docu is not explicitly opened by for instance an edit request with entity & detail.

Maybe you are editing a Paie entity, and inserting a document as detail? In that case, hook you're code into the OnInsertDetailPaieDocu event

answered by (6.8k points)
1,166 questions
1,424 answers
1,715 comments
325 users