C# Windows Form w/ Web Service Error - Job Task Dimensions

booneboone Member Posts: 23
edited 2014-02-25 in NAV Three Tier
I'm working on a C# WFA to expedite our Employee, Vendor, Customer, Job, and Job Task creation process. I've gotten the first 4 done perfectly. Everything works great until I come to the Job Tasks. I am able to create Job Tasks under a given Job, pulling in the Dimensions 1 & 2 that are assigned to the main job. I then need to assign Dimensions 3 & 4 to the Tasks. I'm trying to do this through the same method I've used for all the other creations, but I'm receiving the following error:
At least one dimensional value code must have a value.  Enter a value or delete the Job Task Dimension. .


See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ServiceModel.FaultException: At least one dimension value code must have a value. Enter a value or delete the Job Task Dimension. 

Server stack trace: 
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeEndService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at VendorForm.NAVJobTaskDims.JobTaskDims_Port.EndCreate(IAsyncResult result)
   at VendorForm.NAVJobTaskDims.JobTaskDims_PortClient.VendorForm.NAVJobTaskDims.JobTaskDims_Port.EndCreate(IAsyncResult result) in c:\*FOLDER PATH*\Reference.cs:line 1328
   at VendorForm.NAVJobTaskDims.JobTaskDims_PortClient.EndCreate(IAsyncResult result) in c:\*FOLDER PATH*\Reference.cs:line 1333
   at VendorForm.NAVJobTaskDims.JobTaskDims_PortClient.OnEndCreate(IAsyncResult result) in c:\*FOLDER PATH*\Reference.cs:line 1343
   at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)


I've removed all variables to see if a hard-coded record would go in, but it still errors:
private void button9_Click(object sender, EventArgs e)
        {
            var bindingtaskdimjob = new BasicHttpBinding();
            bindingtaskdimjob.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
            bindingtaskdimjob.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;

            var clienttaskdimjob = new NAVJobTaskDims.JobTaskDims_PortClient(
                bindingtaskdimjob,
                new EndpointAddress("http://*WEBSERVICE*/Page/JobTaskDims"));
            clienttaskdimjob.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Delegation;

            NAVJobTaskDims.JobTaskDims taskdimjob = new NAVJobTaskDims.JobTaskDims
            {
                Job_Task_No = "AST-1",
                Job_No = "2107-TESTING",
                Dimension_Code = "BUS UNIT",
                Dimension_Value_Code = "CS"
            };

            clienttaskdimjob.CreateAsync(taskdimjob);


The Job_Task_No, Job_No, Dimension_Code, and Dimension_Value_Code all exist.

Anybody have any ideas where I may have gone wrong?

Comments

  • vremeni4vremeni4 Member Posts: 323
    Hi,

    This is indeed an error that one would not expect.
    The error message "At least one dimensional value code must have a value" means
    that a dimension was setup with the option "Value Posting" ="Code Mandatory",
    but the dimension value was not provided.

    I would start NAV -> Job Card and go to "2107-TESTING" job.
    From there I would navigate to the Job Task "AST-1", and I would try manually to create
    dimension "BUS UNIT" with the Dimension Value "CS".
    If I get an error message would look what is the cause.

    Anyhow there is a code on inserting a Job Task that creates the same dimension for Job task which exist for the job.
    So it may be worth to check whether Job "2107-TESTING" has all dimension and dimension values set.

    I hope this helps.
  • booneboone Member Posts: 23
    Thanks for the response, vremeni4. I am able to insert the dimensions through the Job Card successfully, but I'm still getting the error through my custom Windows Form. I am getting the Dimensions to automatically pull onto the Job Tasks from the main Job, but unfortunately, the main Job will only be designated with DEPARTMENT and COUNTRY, not BUS UNIT and PRODUCT, as there can be multiple BUS UNIT and PRODUCT tasks for the same Job.

    Anybody else with any other ideas? Or does somebody maybe have some experience/knowledge that could tell me that this just isn't doable and I'm wasting my time? ](*,)
  • vremeni4vremeni4 Member Posts: 323
    Hi,

    Is it possible to confirm what page do you use
    1005 Job Task Dimensions
    OR
    1006 Job Task Dimensions Multiple

    If it is "Job Task Dimensions Multiple" then I would understand the error message. In that case try the page
    "Job Task Dimensions" and your code should work

    It may be also worth to create a new page e.g. 50000 My Job Task Dimensions. With no code.
    Temporary you can comment out the code on the "Job Task Dimension" table. (No Validation or Insert trigger to be run)
    Try to insert the record from this new page.
    This would identify whether the problem is on the NAV or C# side.

    I hope this helps.
  • booneboone Member Posts: 23
    Thanks again, vremeni. I can confirm that I am using page 1005 Job Task Dimensions. After growing extremely irritated with the problem, I decided to try a different method, which worked. I am now creating the Tasks using the web service code, as originally planned, but rather than using a similar code to insert the Dimensions, I have written a code to insert the Dimensions directly into the SQL table. It might not be ideal, but it works.
Sign In or Register to comment.