Skip to main content
Solved

Update Payroll Tax Settings with Rest API


I can get the GET call working with $expand=TaxSettings but the PUT call fails 

Please help with updating PREmployeeAttributes. This is a detail entity for top level entity EmployeePayrollSettings.

 

Been at it for 3 days now. Any Help would be appreciated, Novice here

Best answer by bhitterdal75



@geauxgunturu we have been doing a lot with the Acumatica Payroll APIs

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

                }

            }

            

   ]

}

 

View original
Did this topic help you find an answer to your question?

10 replies

jinin
Pro I
Forum|alt.badge.img+11
  • Pro I
  • 671 replies
  • January 31, 2023

Hi @geauxgunturu 

Can you please share your JSON request and endpoint url to review the issue?


  • Author
  • Freshman I
  • 9 replies
  • January 31, 2023

curl --location --request PUT 'https://harmonelectric.acumatica.com//entity/Default/22.200.001/EmployeePayrollSettings?$expand=TaxSettings' \
--header 'Content-Type: application/json' \
--header 'Cookie: .ASPXAUTH=D9B7F0E1E147301EBEFE87A2CACAFCDD1905304070C05F7A38DCD41EC588E4F881D6846723745C54CB45259FD3AECE5603BEC196B11A2A0CE66BCFF49351B5E919E5DBB3A19B36536A400FDAF176EB46A28A2ECE418AC1D3D6ADC1F9045A43E7FCD99B0C3181EC3B246A06ECA5829CCE13C4A93F47FF9D3D9D6DC68B338562B4B5EB42330AAA985422A99DB4F8880FB29187AC1D; ASP.NET_SessionId=vpnfwtso31kyrduurrqyiwsz; CompanyID=BizRun Tenant; Locale=TimeZone=GMTM0700A&Culture=en-US; UserBranch=1; requestid=D573F0276302518311EDA171C02CE880; requeststat=+st:7845+sc:~/entity/default/22.200.001/employeepayrollsettings+start:638107713455898368+tg:' \
--data-raw '{
    "id": "3947c002-43d0-eb11-818d-0276c812300c",
    
    "TaxSettings": [
       
        {
            "id": "391b4c2c-1a76-ed11-834f-026327f073d5",
            "rowNumber": 37,
            "note": {
                "value": ""
            },
            "AdditionalInformation": {
                "value": "Enter the six-digit SOC Code for the position held by the employee using the Federal statistical standard"
            },
            "CompanyNotes": {},
            "FormBox": {
                "value": ""
            },
            "LastModifiedDateTime": {
                "value": "2022-12-09T20:35:37.817+00:00"
            },
            "Name": {
                "value": "Standard Occupational Classification (SOC)"
            },
            "Required": {
                "value": false
            },
            "Setting": {
                "value": "Employee_FED_StandardOccupationalClassification"
            },
            "State": {
                "value": "FED"
            },
            "UseDefault": {
                "value": false
            },
            "UsedforTaxCalculation": {
                "value": false
            },
            "Value": {
             "value":"123456"
            }
           
        }
    ]
}'


  • Author
  • Freshman I
  • 9 replies
  • January 31, 2023

"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__DisplayClass90_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()",
        "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.<>c__DisplayClass39_0.<InsertUpdateTaxSettingDetail>b__2(PREmployeeAttribute x)\r\n   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)\r\n   at PX.Objects.EndpointAdapters.DefaultEndpointImplPR.InsertUpdateTaxSettingDetail(PXGraph graph, EntityImpl entity, EntityImpl targetEntity)"


jinin
Pro I
Forum|alt.badge.img+11
  • Pro I
  • 671 replies
  • February 1, 2023

Hi @geauxgunturu 

Able to update the records on the screen? I tried to import the tax details and got the same issue on the screen. Am using the demo Data, Maybe some data issues.

 

Can you please try the below request once and let me know able to update the value field?

{

    "Active": {

        "value": true

    },

    "EmployeeID": {

        "value": "EP00000001"

    },

    "EmployeeName": {

        "value": "Michael Andrews"

    },

    "TaxSettings": [

        {

            "Name": {

                "value": "Standard Occupational Classification (SOC)"

            },

            "Value": {

                "value": "123456"

            }

        }

    ]

}


  • Author
  • Freshman I
  • 9 replies
  • February 1, 2023

Still getting object reference error

 

curl --location --request PUT 'https://harmonelectric.acumatica.com//entity/Default/22.200.001/EmployeePayrollSettings?$expand=TaxSettings' \
--header 'Content-Type: application/json' \
--header 'Cookie: .ASPXAUTH=C505755405D4BBF9037C23572347FFDBF66AF4615924659B57043565D07235370BD3EFC3D0D36E7359DB178AD302C812ADB835C7D7CE555A36361C5BA294BF36E52A90C3E74007B92701CED6A94F4D3D00584E161EAFC20E589BAA772BFDC628C1C01B519FE2C5715993950EC2674043F3383A9BE0DD8B52C7A5FEA310F9FCC6FB1C89642FA31DEA9C81A39FB66DA3614F9C4C6A; ASP.NET_SessionId=uqmrhlpwlys10d5ynfrbvi3o; CompanyID=BizRun Tenant; Locale=TimeZone=GMTM0700A&Culture=en-US; UserBranch=1; requestid=D573F0276302518311EDA23BF783B58A; requeststat=+st:6299+sc:~/entity/default/22.200.001/employeepayrollsettings+start:638108582001474200+tg:' \
--data-raw '{

    "Active": {

        "value": true

    },

    "EmployeeID": {

        "value": "EP00000001"

    },

    "EmployeeName": {

        "value": "Michael Andrews"

    },

    "TaxSettings": [

        {

            "Name": {

                "value": "Standard Occupational Classification (SOC)"

            },

            "Value": {

                "value": "123456"

            }

        }

    ]

}'


  • Author
  • Freshman I
  • 9 replies
  • February 1, 2023

I switched the employeeID to ours and get the same error.

curl --location --request PUT 'https://harmonelectric.acumatica.com//entity/Default/22.200.001/EmployeePayrollSettings?$expand=TaxSettings' \
--header 'Content-Type: application/json' \
--header 'Cookie: .ASPXAUTH=C505755405D4BBF9037C23572347FFDBF66AF4615924659B57043565D07235370BD3EFC3D0D36E7359DB178AD302C812ADB835C7D7CE555A36361C5BA294BF36E52A90C3E74007B92701CED6A94F4D3D00584E161EAFC20E589BAA772BFDC628C1C01B519FE2C5715993950EC2674043F3383A9BE0DD8B52C7A5FEA310F9FCC6FB1C89642FA31DEA9C81A39FB66DA3614F9C4C6A; ASP.NET_SessionId=uqmrhlpwlys10d5ynfrbvi3o; CompanyID=BizRun Tenant; Locale=TimeZone=GMTM0700A&Culture=en-US; UserBranch=1; requestid=D573F0276302518311EDA23C2B296ECF; requeststat=+st:4610+sc:~/entity/default/22.200.001/employeepayrollsettings+start:638108582887954068+tg:' \
--data-raw '{

    "Active": {

        "value": true

    },

    "EmployeeID": {

        "value": "E0002"

    },

    "EmployeeName": {

        "value": "Kelly Butts"

    },

    "TaxSettings": [

        {

            "Name": {

                "value": "Standard Occupational Classification (SOC)"

            },

            "Value": {

                "value": "123456"

            }

        }

    ]

}'

 

"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.<>c__DisplayClass39_0.<InsertUpdateTaxSettingDetail>b__2(PREmployeeAttribute x)\r\n   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)\r\n   at PX.Objects.EndpointAdapters.DefaultEndpointImplPR.InsertUpdateTaxSettingDetail(PXGraph graph, EntityImpl entity, EntityImpl targetEntity)"
        }
    }


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2546 replies
  • March 16, 2023

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


  • Author
  • Freshman I
  • 9 replies
  • March 17, 2023

No. Unfortunately, getting the object reference error. Might be a bug. I’m going to get in touch with our assigned support and see if they can help us


  • Freshman II
  • 3 replies
  • Answer
  • April 6, 2023



@geauxgunturu we have been doing a lot with the Acumatica Payroll APIs

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

                }

            }

            

   ]

}

 


  • Author
  • Freshman I
  • 9 replies
  • April 6, 2023

Thank you. You are a life saver. I tried it on my postman and it worked. Thank you. Have a great long weekend


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