Table Question: Want to decrease the value of a ( Quantity )

Posted by apodsiad on 13-Aug-2014 08:55

Question :

 

If I have two table :

 

 

Workshop

 

 

 

Material

SN

M_SN

Material _SN

Material _ Name

Workshop _Quantity

Quantity

 

I need to make a trigger that automatically decreases a ( Quantity ) in Material Table when I use this material in ( Workshop _Quantity ) in Workshop Table.

 Does anyone know how to do it please ?

 

many thanks,

Aggy

All Replies

Posted by Orchid Corpin on 13-Aug-2014 09:35

Hi Aggy,

To do this you can create an Update Field Value trigger in the Workshop object, these two objects / tables must be related.

Trigger Properties values:

Record = Material

Field to change = Quantity

In the formula area specify the sample code below:

return parseInt("{!R123456.quantity}") - 1; //R123456 - relationship name

Hope this may help.

Regards,

Orchid

Posted by apodsiad on 13-Aug-2014 09:51

Hello Orchid,

Thanks very much, I'll try that!

best regards,

Aggy

Posted by apodsiad on 14-Aug-2014 05:14

Hi Orchid,

I don’t want to decrease the value of a ( Quantity ) in Material Table 1 , but I want to decrease it by the same value of ( Workshop _Quantity ) in Workshop Table.

        That’s mean I need  ( Quantity in material Table = Quantity in material Table – workshop_quantity in Workshop Table ).

Can you confirm please ?

thanks,

Aggy

Posted by Orchid Corpin on 14-Aug-2014 09:12

Hi apodsiad,

You can specify a return value like:

return parseInt("{!R123456.materialQtyHERE}") - parseInt("{!workshopQtyHERE}"); //R123456 - relationship name

Regards,

Orchid

Posted by apodsiad on 14-Aug-2014 09:13

Many thanks Orchid, will try that

Aggy

This thread is closed