How to update Dimension in Service Line tale- NAV 2018

Hi All,

We have Dimensions as : Department, Country Code, Project Code and Product Code. User wants to take Product wise, Analysis By Dim report in Service Contract.

In Service Contract module, there is no dimension at Service Contract Line level. So what I did, created Shortcut Dimension 1 Code, Shortcut Dimension 2 Code and Dimension Set ID fields in Service Contract Line table. Wrote code to update Product Code. It is working fine.

Now I want to update this Product Code in Service Line table. But when we Create Invoice from Contract, Department, Country Code and Project Code is already creating. Now what I want to do is update my Product Code dimension along with these three dimensions. How can I achieve it? I do not want to overwrite these three dimensions.

Thanks in Advance.