Thursday, March 3, 2011

Set the Business Relationship Account in the Activities Form

Yesterday I had a requirement that said to pre-populate the Business Relationship Account in the Activities Form field Business Account upon creation of a new activity.

To do this I modified the InitValue() method within the smmActivities Data Source:

Forms > smmActivities > DataSources > smmActivities > Methods > InitValue


To do it I had to make sure that the element that was calling the form was the smmBusRelTable, then I assigned the element record to my smmBusRelTable variable. Finally, upon checking the validity of the record, I assigned the busRelTable.BusRelAccount to the busRelAccount in the smmActivities table.

The code is as follows:


THE FOLLOWING CODE GOES INTO THE FORM INIT METHOD
if (element.args().dataset() == tablenum(smmBusRelTable))
    {
        busRelTable = element.args().record();
        //businessRelationRange.value(smmBusRelTable.BusRelAccount);
    }

This Goes in the smmActivities data source initvalue().
    if(busRelTable.BusRelAccount)
    {
        smmActivities.smmBusRelAccount = busRelTable.BusRelAccount;
    }

No comments:

Post a Comment

Thank you for your thoughts. Your comment will appear in my blog shortly after review.

Have a great day!