Apply Vendor Template in CSIDE

jimmyf
Member Posts: 104
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;
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
-
Good morning,
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:IF ConfigTemplateHeader.GET(recWTsetup."Employee Vendor Template") THEN BEGIN RecRef.GETTABLE(recVend); ConfigTemplateMgt.UpdateRecord(ConfigTemplateHeader,RecRef); END; //2014-08-28-> //recVend.MODIFY; recVend.GET(recVend."No."); //<-
Might work. If not, well, I'm just a former consultant...
Kind regards,
Pavel.0 -
I eventually worked it out.
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 anyway0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions