Hi I am trying to apply a Vendor Template to a new Vendor record programmatically in Nav 2013.
If I debug the code the values in the fields configured in the Configuration template lines table seem to be applied however when I run the vendor card the fields are blank!
I have a vendor record variable called recVend and I am using the standard codeunit, Config. Template Management in variable ConfigTemplateMgt
I have attached a screenshot of the template
Here is the code I am using
IF ConfigTemplateHeader.GET(recWTsetup."Employee Vendor Template") THEN BEGIN
RecRef.GETTABLE(recVend);
ConfigTemplateMgt.UpdateRecord(ConfigTemplateHeader,RecRef);
END;
recVend.MODIFY;
0
Comments
I trust the UpdateRecord procedure modifies the Vendor record but keeps original values in your recVend.
So the " recVend.MODIFY; " seems to return all values of the vendor record to the pre-template state.
If you need to "update" recVend in your Nav code, you might like to try this:
Might work. If not, well, I'm just a former consultant...
Kind regards,
Pavel.
RecRef.SETTABLE(recVend); //Apply RecRef to recVend
recVend.MODIFY;
By doing a SETTABLE on the Record Ref variable updated the vendor record with the values assigned o the RecRef.
Thanks anyway