I have imported the data through xml port into a table and now iam creating new items out of it , when i create new items how can i use the item template based on my selection of which template to use.
is there any event subscriber for that, any help will be great, Thanks
Thank you it helped
Maybe you could try to apply the template after the item is inserted?
So switch the two lines before your end statement.
yes Iam trying with same logic, Thanks for the heads up but can we use this at the same time of item creation, without manually selection 'Apply Template.
SMBItemStagingL.SetRange("Import No", ImportNoG);
if SMBItemStagingL.FindSet() then
repeat
if SMBImportSetup."SMB Template No." = '' then begin
Message('SMBtemplate number blank %1', SMBImportSetup."SMB Template No.");
ItemR.Init();
ItemR.Validate("No.", SMBItemStagingL.Reference);
ItemR.Validate("SMB Import No", ImportNoG);
ItemR.Validate(Description, SMBItemStagingL.Designation);
ItemR."SMB Import No" := ImportNoG;
SMBItemStagingL." Error Message" := GetLastErrorText();
ItemTempl.ApplyItemTemplate(ItemR, ItemTemplTableL);
ItemR.Insert(true);
end
Any idea where I went wrong. It doesnot pick the template it creates a item without using the template
Thanks for the Replies, Here my plan is setup a page and the user can select a template from that at the time of item creation through a function, this function will create 100 items at a time for every 100 item a template can be selected, if there is no template is selected then it will only create item with no template
Hi Sainudheen,
With customization you can fulfil your requirement, But it's little confusing like if you are using multiple config. Template for Item creation then 1 of them you want to use as default. Then what is the use of multiple template creation and purpose of selecting template while create a new Item. Because as choose default template system will apply default template on each new Item creation. So I suggest either use only 1 template. Else as I mention you have to do customization.
Hi, Sorry I didn't test it in detail. You can change your mind. After the Item is inserted, you can execute the following method.
This is similar to running Apply Template after creating an item on the BC UI.
Hope this helps.
Thanks.
ZHU
I have setup page and I can select which one I need and based on the selection item will be created using the template
Do you want to use one or both? If one then delete the other one and it will automatically apply.
I need use of the template above
Do you mean you have to create template like above? or use one of the templates from those?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,228 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156