You need to sign in to do that
Don't have an account?
Mick Man
Trigger
who can help me to create a trigger for the custom object Entree/Sortier that the custom object MatierPremiere be updated each time that there is an input or an output
that is to say, if one selects entrée (input), the number of stores of raw material object is updated (+) and if one selects sortie (output), the number of stock of raw material object is updated (- )
that is to say, if one selects entrée (input), the number of stores of raw material object is updated (+) and if one selects sortie (output), the number of stock of raw material object is updated (- )
Your code is here bud ::
trigger EntreeAndSortier on MatierPremiere__c (before update) {
for( MatierPremiere__c mp : trigger.new ){
if( mp.type__c == 'entrée' ){
mp.quantity__c = Trigger.oldMap.get(opp.ID).quantity__c + 1;
}
else if( mp.type__c == 'sortie' ){
mp.quantity__c = Trigger.oldMap.get(opp.ID).quantity__c 1 1;
}
}
}
I dont know field and object api names so please verify before use this code..
:::======================================================================:::
Qusetion Solved ? then mark as best answer to make helpful to others .....
You will need to substitute the correct object and field names in for ChildObject__c, ParentObject__c, Type__c, Quantity__c, MatierPremiere__c also, you will need ot make sure that the if Type__c is stored with the e-acute. Might be worth also doing a toLowerCase on the Type__c field and making your if statements use a lowercase version of entree/sortie
NOTE: This code has not been tested and may contain typographical or logical errors.
thank you for your answer
I want to try to change the code with my own API, but there is an error message as "Error: Erreur de compilation : Illegal assignment from Object to Id à la ligne 23 colonne 25"