Skip to main content
Question

Receiving Error When Creating PREmployeeSettings with 23.xx.xx Web Services Endpoint


Forum|alt.badge.img

Hello,

I am attempting to create a PREmployeeSetting entity via the “Default/23.200.001/EmployeePayrollSetting” endpoint.

My payload looks like this:

{
    "EmployeeID": {
        "value": "TEST1"
    },
    "Active": {
        "value": "true"
    },

    "TaxSettings": [
        {
            "Name": {
                "value": "Social Security Number"
            },
            "Required": {
                "value": true
            },
            "Setting": {
                "value": "Employee_FED_SocialSecurityNumber"
            },
            "State": {
                "value": "FED"
            },
            "Value": {
                "value": "123123123"
            }
        }
    ],
    "CashAccount": {
        "value": "8000-1130"
    },
    "ClassID": {
        "value": "HRLY"
    },
    "PaymentMethod": {
        "value": "CHECK"
    },
    "EmployeeTypeClassDefault": {
        "value": "true"
    },
    "Compensation": [
        {
            "Active": {
                "value": "true"
            },
            "EarningCode": {
                "value": "RG"
            },
            "PayRate": {
                "value": "10.00"
            },
            "StartDate": {
                "value": "2020-01-01"
            },
            "UnitOfPay": {
                "value": "HOUR"
            }
        }
    ],
    "EmployeeWorkLocations": [
        {
            "WorkLocationDetails": [
                {
                    "IsDefault": {
                        "value": "true"
                    },
                    "LocationID": {
                        "value": "1000"
                    }
                }
            ]
        }
    ],
    "DirectDepositDetails": [
        {
            "AccountNumber": {
                "value": "123123123123"
            },
            "Amount": {
                "value": 100
            },
            "AccountType": {
                "value": "Checking"
            },
            "BankName": {
                "value": "Placeholder"
            },
            "BankRoutingNumber": {
                "value": "123123123"
            }
        }
    ]
}

I receive the following error:

{
    "message": "An error has occurred.",
    "exceptionMessage": "Operation failed",
    "exceptionType": "PX.Data.PXInvalidOperationException",
    "stackTrace": "   at PX.Api.ContractBased.EntityService.Put(ISystemContract systemContract, String version, String name, EntityImpl entity, CbOperationContext operationContext, Boolean throwOnError)\r\n   at PX.Api.ContractBased.SystemContracts.FacadeBase.PutImpl(EntityImpl entity, Boolean throwOnValidationError)\r\n   at PX.Api.ContractBased.SystemContracts.V2.RestController.PutEntity(EntityImpl entity, String select, String filter, String expand, String custom)\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.<GetExecutor>b__2(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__15.MoveNext()",
    "innerException": {
        "message": "An error has occurred.",
        "exceptionMessage": "Exception has been thrown by the target of an invocation.",
        "exceptionType": "System.Reflection.TargetInvocationException",
        "stackTrace": "   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)\r\n   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)\r\n   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\r\n   at PX.Api.ContractBased.EntityExportContextBuilder.<>c__DisplayClass91_1.<FindImplementations>b__3(PXGraph graph, EntityImpl entity, EntityImpl targetEntity)\r\n   at PX.Api.SyImportProcessor.SyStep.ProcessLocateByNoteIdCommand(SyCommand cmd, SyView view, Boolean invokeCommand)\r\n   at PX.Api.SyImportProcessor.SyStep.ProcessCommand(SyCommand cmd, Boolean& needCommit)\r\n   at PX.Api.SyImportProcessor.ExportTableHelper.ExportTable(CancellationToken token)",
        "innerException": {
            "message": "An error has occurred.",
            "exceptionMessage": "Object reference not set to an instance of an object.",
            "exceptionType": "System.NullReferenceException",
            "stackTrace": "   at PX.Objects.EndpointAdapters.DefaultEndpointImplPR.InsertUpdateTaxSettingDetail(PXGraph graph, EntityImpl entity, EntityImpl targetEntity)"
        }
    }
}

 

The error relates to the TaxSettings object. If I remove it, the record inserts fine.

What might the issue be? I reviewed the “DefaultEndpointImplPR.InsertUpdateTaxSettingDetail” method, but it did not help pinpoint the issue.

Thanks.

4 replies

Nilkanth Dipak
Semi-Pro I
Forum|alt.badge.img+10

Hi @KellyMarchewa ,

I got similar forum which may help you to solve your issue.

https://community.acumatica.com/import-and-export-scenarios-117/update-payroll-tax-settings-with-rest-api-14068

The solution is: Try changing your Tax Settings payload to look more like this:

{{ACUURL}}/entity/default/22.200.001/EmployeePayrollSettings?$filter=EmployeeID eq 'EMP9996'

{

   "TaxSettings": [



            {

            "Setting": {"value": "Employee_FED_SocialSecurityNumber"},

            "Value": { 

                "value": "498362222"

            }

            },

            {

            "Setting": {"value": "Employee_FED_FederalFilingStatus"},

            "Value": {

                "value": 2

                }

            }



   ]

}

 


Forum|alt.badge.img
  • Author
  • Freshman II
  • 13 replies
  • May 4, 2024

Thanks @Dipak Nilkanth . I tried changing the “TaxSettings” section to

 "TaxSettings": [



            {

            "Setting": {"value": "Employee_FED_SocialSecurityNumber"},

            "Value": { 

                "value": "123123123"

            }

            }

   ],

and adding the ID to the url, but I am still receiving the same error.


Forum|alt.badge.img
  • Author
  • Freshman II
  • 13 replies
  • May 10, 2024

Tried  with the 22.200.001 endpoint as well - same error. Using Build 23.209.0023. The error appears to be thrown here in the DefaultEndpointImplPR class:

 


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2757 replies
  • July 1, 2024

Hi @KellyMarchewa were you able to find a solution? Thank you!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings