Run code after Update of Record
Haribabu
Member Posts: 33
Hi,
I want to Run an XML port once a record is modified, i have added the code in the ONMODIFY() Trigger.
CodeLike this
OnModify()
ItemMaster.SetNo(ItemNo);
ItemMaster.RUN();
this triggers the xmlport but it generates the xml file with LAST saved records.
No. = item1
Desc = Test Item
i changed the description to ITEM1 and tab it , the xml file is generated but with no and description as the same as
given above..
how can i get the updated values in the XML file ??
Any help would be great.
I want to Run an XML port once a record is modified, i have added the code in the ONMODIFY() Trigger.
CodeLike this
OnModify()
ItemMaster.SetNo(ItemNo);
ItemMaster.RUN();
this triggers the xmlport but it generates the xml file with LAST saved records.
No. = item1
Desc = Test Item
i changed the description to ITEM1 and tab it , the xml file is generated but with no and description as the same as
given above..
how can i get the updated values in the XML file ??
Any help would be great.
0
Comments
-
OnModify has not yet commited the record, so it is in effect getting xrec, what you need to do is pass rec to the xmlport.
Try,
OnModify()
CLEAR(ItemMaster);
ItemMaster.SetTableView(Rec);
ItemMaster.RUN();
If that does not work, Create a temporary record variable of type Item, remember to make sure the property is set to temporary.
CLEAR(TempItem);
TempItem.INIT;
TempItem.TRANSFERFIELDS(Rec);
TempItem.INSERT;
CLEAR(ItemMaster);
ItemMaster.SetTableView(TempItem);
ItemMaster.RUN();
I did not think there is a XMLPort.RUN??
These are the functions in 'Version 5' no RUN for XMLPort is this new in 5.1/2009??
ItemXML.SETTABLEVIEW(Rec);
ItemXML.SETTABLEVIEW(Record);
ItemXML.SETSOURCE(Instream);
ItemXML.SETRESPONSE(OutStream);
ItemXML.GETRESPONSE(OutStream);
ItemXML.IMPORT(TRUE);
ItemXML.SETDESTINATION(OutStream);
ItemXML.EXPORT(TRUE);
David :?Analyst Developer with over 17 years Navision, Contract Status - Busy
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com0 -
Hi David,
Sorry the as you said XMLPort Run Does not exist ,
This is the code that i have written in the OnModify() method in the Item Masters Table
OnModify()
ItemNo := TempItem."No.";
CLEAR(TempItem);
TempItem.INIT;
TempItem.TRANSFERFIELDS(Rec);
TempItem.INSERT;
IF EXISTS ('C:\Item.XML') THEN
ERASE ('C:\Item.XML');
TestFile.CREATE('C:\Item.XML');
TestFile.CREATEOUTSTREAM(TestStream);
Item.SetNo(ItemNo);
CLEAR(Item);
Item.SETTABLEVIEW(TempItem);
Item.SetNo(ItemNo);
Item.SETDESTINATION(TestStream);
Item.EXPORT;
TestFile.CLOSE;
MESSAGE('Export complete');
When i change some values and then close the form it throws a message saying
"The Item XMLport dose not have a XMLItem that uses the table(Table 27 Item)specified in the function SetTableView".
I am unable to find out why it is happening..
Any help would be great.0 -
[Topic moved from 'NAV 2009' forum to 'NAV/Navision' forum]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K 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
- 324 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