Values of Masterrecord not available in Loop in trigger

Posted by wweultjes on 22-Dec-2014 06:53

Hello,

I'm working on a trigger that loops through some related records and perform some action on those records with values from the master object.

In the loop below debugging shows that hours and startdatetime are not correctly substituted. Only the suplier field is correctly substitued. This is not what i expected.

Solved this by assigning the hours and startdatetime to a variable before the loops start. Now it's working correctly. 

{!#LOOP_BEGIN.R228075#214066}

performAction("{!R228075,supplier}","{!startDateTime#iso)",{!hours});


{!#LOOP_END.R228075}

Now i'm wondering if this is designed behavior or that i ran in some bug. If it is designed behavior it might be a good idea to substitute also the normal available values as well in the loop.

Regards,

Wilco Weultjes.

All Replies

Posted by Gian Torralba on 22-Dec-2014 08:47

Hello,

What do you mean about the values being substituted? Can you post the returned value in which you are having a problem with?

Thank you,
Gian

Posted by wweultjes on 23-Dec-2014 03:50

Hello Gian,

Here an example.

this code for a workorder with 5 detail lines:

rbv_api.println("{!mtc_enddatetime#iso}");

{!#LOOP_BEGIN.R228075}

rbv_api.println("{!mtc_enddatetime#iso}");

{!#LOOP_END.R228075}    

gives in debug mode:

var rbv_api = new Packages.com.rb.core.services.api.ServerSideAPI(205908, 212352);

rbv_api.println("2014-11-19T14:00:00Z");

rbv_api.println("");

rbv_api.println("");

rbv_api.println("");

rbv_api.println("");

rbv_api.println("");

Regards,

Wilco.

Posted by Gian Torralba on 23-Dec-2014 10:23

Hello,

It is printing the date correctly am I right?

rbv_api.println("2014-11-19T14:00:00Z");

The other println may not have a value in it. You can elaborate this further so that we may have a clear understanding of the issue.

Regards,
Gian

Posted by wweultjes on 24-Dec-2014 05:54

Hello,

Yes it print the line correctly, but only once. I was expecting that the "empty" rbv_api.println also contained a correct date.

I like to print all detail lines of the workorder with some information of that workorder and that doesn't work this way.

Regards,

Wilco.

Posted by Gian Torralba on 24-Dec-2014 09:31

Hello,

May I know your expected output? So that we can provide a clear solution to the issue.

Thank you,
Gian

Posted by pvorobie on 24-Dec-2014 11:38

Can you print "name" and "id" tokens also?

Posted by wweultjes on 29-Dec-2014 02:28

Hello Gian,

I expect that for each detail line the data from the master record will be written. So instead of 5 times rbv_api.println(""); i expect 5 times rbv_api.println("2014-11-19T14:00:00Z");

Regards,

Wilco.

Posted by Gian Torralba on 29-Dec-2014 07:42

Hello,

Can you go to the view page of the master record and display the related detail line record list view with the date field showing? It should print properly if there is a value in each related record,

Thank you,
Gian

This thread is closed