Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

.NET AddIns Change Item Standard Cost

(0) ShareShare
ReportReport
Posted on by

Hello,

Please help me out to write an automated method to execute "Inventory->Utilities->Change Item Standard Cost" screen. As per my business case, we are working on a screen that would recalculate actual standard cost of item and update. I would prefer to directly call the screen with each itemkey and calculated cost and hit process button through code.

I need to create xml document first but not getting way to achieve that.

I found that - GP Screen name is "IV_Item_Standard_Cost_Change"

Method to be called is - Dynamics.Forms.IvItemStandardCostChange.Procedures.StdCostChangeProcess.Invoke

what value of parameters would be passed? specially in inParam6 and inParam7.

*This post is locked for comments

  • Suggested answer
    jo_gourav Profile Picture
    387 on at
    RE: .NET AddIns Change Item Standard Cost

    CompilerError = CompilerApp.ExecuteSanscript(Commands, CompilerMessage)

           If CompilerError <> 0 Then

               MsgBox(CompilerMessage)

           End If

  • Suggested answer
    jo_gourav Profile Picture
    387 on at
    RE: .NET AddIns Change Item Standard Cost

    Hi Steven ,

    You can use  below code to run the macro automatically.

           Dim CompilerApp As Object

           Dim CompilerMessage As String = ""

           Dim CompilerError As Integer

           Dim Commands As String = ""

           ' Create link without having reference marked

           CompilerApp = CreateObject("Dynamics.Application")

               Commands = Commands & "local integer l_file_id; " & vbCrLf

               Commands = Commands & "local string pathname; " & vbCrLf

               'Commands = Commands & "pathname = Path_MakeNative(Path_GetForApp(PATH_EXEFOLDER)) + \UpdateStandardCost.MAC"

               Commands = Commands & "pathname = Path_MakeNative(Path_GetForApp(PATH_EXEFOLDER) + ""\UpdateStandardCost.mac"" ) ; "

               Commands = Commands & "l_file_id = TextFile_Open(pathname, 0, 0); "

               Commands = Commands & "TextFile_WriteLine(l_file_id, ""Put Your Macro Logic in this code""  ); "

               Commands = Commands & "TextFile_Close(l_file_id); "

               Commands = Commands & "if File_Probe(pathname) then "

               Commands = Commands & "  run macro pathname; "

               Commands = Commands & "end if;

  • Community Member Profile Picture
    on at
    RE: .NET AddIns Change Item Standard Cost

    I have created a macro that pulls list of items with standard costs. User is supposed to run it from change standard cost screen. Could it be invoked automatically?

    I tried with this as I couldn't achieve success with earlier attempts. I tried to invoke change standard cost utility directly through .net code.

  • Community Member Profile Picture
    on at
    RE: .NET AddIns Change Item Standard Cost

    Thanks Soma,

    I had planned to do that earlier but I was willing to simply invoke the procedure  of change item standard cost screen; pass itemkey and changed cost as parameter and hit the process button through code. I thought it would be more feasible and GP will automatically handle the rest. Please help me to update if it could be achieved.

  • Suggested answer
    soma Profile Picture
    24,410 on at
    RE: .NET AddIns Change Item Standard Cost

    Open Dex.ini file in notepad (File available under Data folder of GP installation folder) and add the below line to the end.

    ScriptDebugger=TRUE

    Now, open Change Item Standard Cost window in GP. Here you can see the menu Debug menu. Select Debug-->Log Script. Now system will ask you to save the script. Then change the standard cost of any item and click the process button. After item cost has been changed, click Debug-->Log script again. Then open the saved script to find out that process button script with all required parameter values.

    You can use the same values to your .Net coding.

    Hope this helps!!!

  • Suggested answer
    Andrew John Dean Profile Picture
    1,337 on at
    RE: .NET AddIns Change Item Standard Cost

    Hi Steven

    I suggest you try the the Support Debug Tool (recently renamed GP Power Tools), and put a trace on the Dexterity function calls to determine the parameter values that are being passed to the procedure [Std_Cost_Change_Process].

    Regards

    Andrew Dean

    1220.Outlook-signature.jpg

  • Tim Wappat Profile Picture
    5,703 on at
    RE: eConnect Change Item Standard Cost

    I would click "Actions" under your original post, then Edit and change the title, this is not eConnect question but rather a .NET Addin question, you are more likely to catch the right viewers' eyes.

  • Community Member Profile Picture
    on at
    RE: eConnect Change Item Standard Cost

    I want to call the method in .NET code -

    Dynamics.Forms.IvItemStandardCostChange.Procedures.StdCostChangeProcess.Invoke()

    Param6 accepts Microsoft.Dexterity.Applications.DynamicsDictionary.IvStdCostAdjTempTable

    and param7 accepts

    Microsoft.Dexterity.Applications.DynamicsDictionary.IvItemDetailsCompositeData

    I need to know how to pass object to these params.

    Microsoft.Dexterity.Applications.DynamicsDictionary.IvStdCostAdjTempTable._Instance() is of the same type. I need to pass Item number and updated cost and invoke standard cost change process. If I do create object of  Microsoft.Dexterity.Applications.DynamicsDictionary.IvStdCostAdjTempTable._Instance() and try to pass itemnumber and cost then it does not accept as these are readonly fields.

  • Suggested answer
    sandipdjadhav Profile Picture
    18,297 on at
    RE: eConnect Change Item Standard Cost

    Stevan,

    i don't see any eConnect schema for Changing Item Standard cost. 

    eConnectItem.PNG

    One of my project I created macro. But again you need to make sure there is no unposted transactions for those Items.

    Thanks 

    Sandip

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >

Featured topics

Product updates

Dynamics 365 release plans