'Cash Account' cannot be empty - acumatica

When trying to create a new Customer using the REST API, it throws the following exception when PUT at the endpoint https://my.site/entity/Default/17.200.001/Customer
PX.Data.PXException: Error: 'Cash Account' cannot be empty.
PX.Data.PXOuterException: Error: Inserting 'Customer Payment Method' record raised at least one error. Please review the errors.
at PX.Data.PXUIFieldAttribute.CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e)
at PX.Data.PXCache.OnCommandPreparing(String name, Object row, Object value, PXDBOperation operation, Type table, FieldDescription& description)
at PX.Data.PXTableAttribute.PrepareParametersForInsert(PXCache sender, Object row, Type[] tables, ISqlDialect dialect, Boolean audit, List`1[] pars)
at PX.Data.PXTableAttribute.PersistInserted(PXCache sender, Object row)
at PX.Data.PXCache`1.PersistInserted(Object row)
at PX.Data.PXCache`1.Persist(PXDBOperation operation)
at PX.Data.PXGraph.Persist(Type cacheType, PXDBOperation operation)
at PX.Data.PXGraph.Persist()
at PX.Objects.CR.BusinessAccountGraphBase`3.Persist()
at PX.Objects.AR.CustomerMaint.Persist()
at PX.Data.PXSave`1.d__2.MoveNext()
at PX.Data.PXAction`1.d__31.MoveNext()
at PX.Data.PXAction`1.d__31.MoveNext()
at PX.Api.SyImportProcessor.SyStep.a(Object A_0, PXFilterRow[] A_1, PXFilterRow[] A_2)
at PX.Api.SyImportProcessor.ExportTableHelper.ExportTable()
The JSON I'm using to create the customer is:
{
"CustomerID": {
"value": "ABCD1234"
},
"CustomerName": {
"value": "TEST CUSTOMER"
},
"CustomerClass": {
"value": "01"
},
"StatementCycleId": {
"value": "01"
},
"ShippingAddressSameAsMain": {
"value": true
},
"CashAccount": {
"value": "BANAMEXMN"
},
"MainContact": {
"DisplayName": {
"value": "TEST CUSTOMER"
},
"Email": {
"value": "a#b.com"
},
"Address": {
"AddressLine1": {
"value": "Test test"
},
"AddressLine2": {
"value": "Test test"
},
"City": {
"value": "Monterrey"
},
"State": {
"value": "NL"
},
"PostalCode": {
"value": "00300"
},
"Country": {
"value": "MX"
}
}
}
}
I've looked at the Endpoints screen but I can't find the CashAccount attribute under the Customer definition. The only place where I've found it is under Customer Payment Method but that'd be for creating a new Method, not adding the method to the customer.

For REST Web Services:
You need to extend the endpoint to add the cash account field:
Then select the PaymentInstructions entity in the left pane tree view and click on Extend Entity then Populate:
This will open a popup from where you can add the cash account field:
Finally when you call web service, change the 'Default' endpoint name in URL with the one you chose for the extended endpoint:
Ex:
http://domain/virtual_directory/entity/DefaultPlus/
instead of:
http://domain/virtual_directory/entity/Default/
For Screen Web Services:
Use Help->Web Service->Service Description to locate the fields:
This will open the XML Web Service Description where you can see which field can be passed with JSON:
Notice that the field container is named BillingSettingsDefaultPaymentMethod which matches the name of the tab and group box where the CashAccount field is located:
The JSON pattern to pass the field in BillingSettingsDefaultPaymentMethod group is the same one you're already using for MainContact. Notice that it only populates MainContact, it doesn't create a new contact. Same applies for default payment method group, it won't create a new payment method, it will only populate the Billing Settings tab Default Payment Method group fields.
The CashAccount field in your request is on the top level entity (Customer/BAccount) instead of being in the BillingSettingsDefaultPaymentMethod group. I suspect it doesn't exists at that level so you should remove it. To confirm it doesn't exists, look a the JSON response, it should omit the invalid fields in the response. It does so silently without raising an error.

Related

Acumatica - Updating User-Defined Field 'View' Error

I am trying to update a Custom Attribute on the Contact entity. Here is the structure for the request body (which works to update regular fields when 'custom' is not included):
{
"ContactID": {
"value" : {{record.ContactID.value}}
},
"custom" : {
"Document":
{
"AttributeEXPORTEDMC" :
{
"type": "Checkbox",
"value": "True"
}
}
}
}
Getting this error: 'An error has occurred.","exceptionMessage":"view Document is not found","exceptionType":"System.InvalidOperationException","stackTrace":" at PX.Api.ContractBased.EntityExportContextBuilder.EnsureCustomField(CustomField customField, String[] views)\r\n at System.Monads.MaybeIEnumerable.Do[TSource](IEnumerable`1 source,'.
The documentation saying that the view will always be 'Document' for user defined fields.
'For any user-defined field, the view name is Document'
Field/View Name Documentation
From: https://help-2020r1.acumatica.com/(W(28))/Help?ScreenId=ShowWiki&pageid=bd0d8a36-b00b-44c8-bdcd-b2b4e4c86fd0
[Update]
Had to first create a UDF. Here is the working version for this case (v2 API):
{
"ContactID": {
"value": {{record.ContactID.value}}
},
"custom": {
"Contact": {
"AttributeEXPORTEDMC": {
"type": "CustomBooleanField",
"value": true
}
}
}
}
You can add a UDF to the endpoint as such and modify it like any other field

Modify Stripe subscription status

I have been trying to modify the subscription 'status' from 'trialing' to 'active' once the user buys our standard subscription but it doesn't recognize the parameter 'status'.
Post URL : https://api.stripe.com/v1/subscriptions/sub_DlwSiqrLvSArgV
Request body:
{
"Status": "active",
"items": {
"0": {
"id": "si_DlwSpUvFPN6Mje",
"deleted": "true"
},
"1": {
"plan": "plan_Dk4I92tnE0cmXS"
}
}
}
Response:
{
"error": {
"code": "parameter_unknown",
"doc_url": "https://stripe.com/docs/error-codes/parameter-unknown",
"message": "Received unknown parameter: Status",
"param": "Status",
"type": "invalid_request_error"
}
}
I'm not sure if I'm putting the status in wrong place or if i need to add some other additional parameter(s) to change the status.
The status property is calculated by Stripe and it's not something you can set yourself. It is not in the list of parameters for the Update Subscription API either.
If you want to move a subscription from 'trialing' to 'active' you have to explicitly end the trial period by passing trial_end: "now" as documented here. This will automatically charge the customer the expected amount and if the charge succeeds it will switch your subscription to active at the same time.

Is it possible to change verbiage of listAuditEvents?

The current [Envelopes: listAuditEvents] creates the following verbiage for correction:
"eventFields": [
{
"name": "logTime",
"value": "2018-09-18T19:09:01.3603686Z"
},
{
"name": "Source",
"value": "api"
},
{
"name": "UserName",
"value": "Staging"
},
{
"name": "UserId",
"value": "8c57af14-e46a-4965-ae8b-42bb0c29b706"
},
{
"name": "Action",
"value": "Correction Initiated"
},
{
"name": "Message",
"value": "Staging initiated correction"
},
{
"name": "EnvelopeStatus",
"value": "correct"
},
I would like to modify the Message values. I have gone through Docusigns API but I have not found any indication that this is possible.
Has anyone had the same need? and if so were you able to add custom message verbiage for certain events/actions?
Thanks.
It's not possible for you to configure the contents of the API response for the listAuditEvents operation. However, you could (in your code) include logic to parse the API response and based on certain values in the response, substitute values (for purposes in your app) with the verbiage you prefer.
For example, let's say that you have a page in your app that displays the various events that have occurred for an Envelope, but you don't want to display the verbiage "[UserName] initiated correction" as the text in your UI when a user initiates an envelope correction -- instead you want to display the text "[UserName] changed envelope settings." The logic in your code could do something like this psuedo code shows (where auditEvent represents an object within the API response body for the listAuditEvents operation):
if (auditEvent.ActionInitiated == "Correction Initiated") {
displayMessageInUI(auditEvent.UserName + " changed envelope settings.");
}

How to filter SharePoint list items by Created by in Microsoft Graph?

I'm trying to get a collection of list items from a SharePoint through Microsoft Graph, which I want to filter by CreatedBy.
Requesting: https://graph.microsoft.com/v1.0/sites/{siteid}/lists/TeamRequests/items
Returns:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#sites('{url}')/lists('TeamRequests')/items",
"value": [
{
"#odata.etag": "\"56ad787e-bd69-464a-b5da-dd953e40d7c4,13\"",
"createdDateTime": "2018-02-26T08:34:26Z",
"eTag": "\"56ad787e-bd69-464a-b5da-dd953e40d7c4,13\"",
"id": "11",
"lastModifiedDateTime": "2018-03-22T13:20:03Z",
"webUrl": "{url}/Lists/TeamRequests/11_.000",
"createdBy": {
"user": {
"email": "{email}",
"id": "9c9cbb67-c049-4a2d-845d-6c5ca2300041",
"displayName": "{Name}"
}
},
"lastModifiedBy": {
"user": {
"email": "{email}",
"id": "9c9cbb67-c049-4a2d-845d-6c5ca2300041",
"displayName": "{Name}"
}
},
"parentReference": {},
"contentType": {
"id": "0x01005F15F8133495554D834FF82F187AD0630002133A9CCDE4494D8CB2206D7D6453D6"
}
},
Now I'd like to filter this request for createdBy, either Id, displayName or email address. I tried ?$filter=createdBy/user/email eq '{email}' and similar requests for id or displayName. They all return
{
"error": {
"code": "generalException",
"message": "An unspecified error has occurred.",
"innerError": {
"request-id": "492e3bde-05fe-4484-a475-435ff0aa70b6",
"date": "2018-07-23T07:41:46"
}
}
}
So how to accomplish this filter? Is it even supported?
Even though it sounds like a straightforward query, i have not come up to anything more simple then the following solution:
It seems filtering by user field is not supported except the case when user id is provided, that's the reason why the solution consists of two steps:
1) First, we need to determine user Id by Email , for that purpose the following query could be utilized:
https://graph.microsoft.com/v1.0/sites/root/lists('User Information List')/items?expand=fields(select=Id,Email)
*where User Information List system list stores user properties including Id and Email properties *
2) Once the user Id is resolved, the final query to filter items by user id could be applied:
https://graph.microsoft.com/v1.0/sites/{site-id}/lists('list-name')/items?filter=fields/<user-field-name>LookupId eq '<user-id>'
where
<user-field-name>LookupId is a field which is getting exposed in addition to user field, in case of Created field the name should be AuthorLookupId
Example:
https://graph.microsoft.com/v1.0/sites/root/lists('TeamRequests')/items?filter=fields/AuthorLookupId eq '10'
Note
In some cases the following error is returned Field ''
cannot be referenced in filter or orderby as it is not indexed.
Provide the 'Prefer: HonorNonIndexedQueriesWarningMayFailRandomly'
header to allow this, but be warned that such queries may fail on
large lists.
In that case the following request header needs to be applied:
Prefer: HonorNonIndexedQueriesWarningMayFailRandomly
When I tried to access User Information List list. There is an error with list not found.
So since in my case, first I filtered list data based on status value and next step got the logged in user display name and filtered listitems based on display name.
I'm using #pnp/graph
Filter list data with status filter
let resultsList = await listItemsQuery.filter("fields/RequestStatus eq 'Approval Pending'").expand("fields").get<MicrosoftGraph.ListItem[]>();
Get Logged-In Profile:
const profileQueryEndPoint = new GraphQueryableCollection(graph.me, "/");
Select displayName property from above result
let profileData : User = await profileQueryEndPoint.select("displayName").get <User>();
console.log('displayName : ' + profileData['displayName']);
Filter ListItems with createdby Field by passing profileData['displayName']
let filterUserCreatedRequests: MicrosoftGraph.ListItem[] = resultsList.filter(ListItem => ListItem["createdBy"].user.displayName === profileData['displayName']);
Display filtered results
console.log('filterUserCreatedRequests : ' + JSON.stringify(filterUserCreatedRequests));
I'm giving all the steps for your reference. But above code can simplified more.
Hope this helps someone :)

Pre-populating user's ID Check - Personal Information in DocuSign when using templateRoles

I'm currently using the rest api (.../v2/accounts/someId/envelopes) to request a users document. My app currently requests a document that has a corresponding template, with most of the data on that pre-filled using the templateRoles key. When users are prompted for an ID Check they are again asked information that we already have (name, address ect). We would like to have this information pre-filled.
I have looked through the documentation but none of the examples for idCheckInformationInput use templateRoles. Ideally we would not have to change the structure of the current api call since it is quite mature and well tested. I have tried adding the idCheckInformationInput key, but the ID Check is still returned blank.
Our current call is:
.../v2/accounts/someId/envelopes
data => {
"allowMarkup":false,
"allowReassign":false,
"allowRecipientRecursion":false,
"asynchronous":false,
"authoritativeCopy":false,
"autoNavigation":false,
"brandId":"xxxx",
"compositeTemplates":null,
"customFields":null,
"emailBlurb":"",
"emailSubject":"Secure Authorization Document",
"enableWetSign":false,
"enforceSignerVisibility":false,
"envelopeIdStamping":false,
"eventNotification":{
"envelopeEvents":[
{
"envelopeEventStatusCode":"completed",
"includeDocuments":false
},
{
"envelopeEventStatusCode":"declined",
"includeDocuments":false
},
{
"envelopeEventStatusCode":"voided",
"includeDocuments":false
}
],
"loggingEnabled":true,
"includeCertificateWithSoap":false,
"includeDocuments":false,
"includeTimeZone":false,
"includeSenderAccountAsCustomField":false,
"recipientEvents":[
],
"requireAcknowledgment":true,
"signMessageWithX509Cert":false,
"soapNameSpace":"",
"url":"xxxx/external/signing/eventnotification",
"useSoapInterface":false
},
"signingLocation":"Online",
"status":"sent",
"templateId":"xxxx",
"templateRoles":[
{
"accessCode":null,
"clientUserId":"xxxx",
"email":"xxxx#xxxx.com",
"emailNotification":null,
"name":"a a a",
"recipientId":"1",
"roleName":"Client",
"tabs":{
"checkboxTabs":[
{
"name":"Checkbox",
"selected":false,
"tabLabel":"ExchangeEtcEmployed"
},{...}
],
"radioGroupTabs":[
],
"textTabs":[
{
"name":"Text",
"tabLabel":"\\*DOB",
"value":"1/1/1980"
}, {...}
]
},
"idCheckConfigurationName": "ID Check $",
"idCheckInformationInput":{ //new key possibly in the wrong spot
"addressInformationInput":{
"addressInformation":{
"street1":"aaa",
"street2":"",
"city":"San Francisco",
"state":"CA",
"zip":"94102"
},
"displayLevelCode":"Editable"
},
"dobInformationInput":{
"dateOfBirth":"1/1/1980",
"displayLevelCode":"Editable"
},
"ssn4InformationInput":{
"ssn4":"4444",
"displayLevelCode":"Editable"
}
}
}
]
}
I've also noticed that if I add requireIdLookup: true, and turn off the flag on docusign's side (manage -> template -> roles -> Identify -> Identity Check = ID Check $) no ID check shows up. The only way to get it to show up is to check that, and it is always returned empty.
EDIT:
I have more recently tried to use the format specified here but with the same results as before:
{
"allowMarkup":false,
"allowReassign":false,
"allowRecipientRecursion":false,
"asynchronous":false,
"authoritativeCopy":false,
"autoNavigation":false,
"brandId":"xxxx",
"compositeTemplates":[
{
"inlineTemplates":[
{
"sequence":"1",
"recipients":{
"signers":[
{
"accessCode":null,
"clientUserId":"xxxx",
"email":"xxx#xxx.com",
"emailNotification":null,
"name":"a a a",
"recipientId":"1",
"roleName":"Client",
"tabs":{
"checkboxTabs":[...],
"radioGroupTabs":[...],
"textTabs":[...]
},
"idCheckInformationInput":{
"addressInformationInput":{
"addressInformation":{
"street1":"aaa",
"street2":"",
"city":"San Francisco",
"state":"CA",
"zip":"94105"
},
"displayLevelCode":"Editable"
},
"dobInformationInput":{
"dateOfBirth":"1/1/1980",
"displayLevelCode":"Editable"
},
"ssn4InformationInput":{
"ssn4":"xxxx",
"displayLevelCode":"Editable"
}
},
"requireIdLookup":true,
"idCheckConfigurationName":"ID Check $"
}
]
}
}
],
"serverTemplates":[
{
"sequence":"1",
"templateId":"xxx"
}
]
}
],
"customFields":null,
"emailBlurb":"",
"emailSubject":"Secure Authorization Document",
"enableWetSign":false,
"enforceSignerVisibility":false,
"envelopeIdStamping":false,
"eventNotification":{...},
"signingLocation":"Online",
"status":"sent",
"templateId":null,
"templateRoles":null
}
Edit2:
I was able to get it to work-ish with the compositeTemplates format, although I had to remove the roleName. With the roleName set to "Client" it strictly follows what is defined in the Roles section of the template for "Client" (recipients and routing modal), and ignores the passed requireIdLookup key as well as any idCheckInfromationInput. Removing the role also stops any of the document's inputs from being filled with the tabs data--which makes sense considering the tags are role specific.
Ideally I could use the templateRoles version, but I would be happy with the compositeTemplates working with a role. You should be able to specify ID Check $ under the Identify column in the roles modal for a given template, and then have that ID Check filled in if you pass in idCheckInfromationInput.
It looks to me like the idCheckInformationInput is in the right spot, however you are missing the idCheckConfigurationName and requireIdLookup entries. Please check the documentation snippet below and small sample below:
https://www.docusign.com/p/RESTAPIGuide/RESTAPIGuide.htm#REST%20API%20References/Recipients/Signers%20Recipient.htm?Highlight=idCheckInformationInput
"name":"a a a",
"recipientId":"1",
"roleName":"Client",
...
"requireIdLookup" :"true",
"idCheckConfigurationName": "ID Check $",
"idCheckInformationInput": {
"addressInformationInput": {
"addressInformation": {
"street1": "sample string 1",
"street2": "sample string 2",
"city": "sample string 3",
"state": "sample string 4",
"zip": "sample string 5",
"zipPlus4": "sample string 6"
},
"displayLevelCode": "sample string 1",
"receiveInResponse": "sample string 2"
},
To get this to work I needed to switch to the compositeTemplates format, and to get passed the issue with the roleName I had to UNCHECK "Sender Cannot Edit recipient" in the cog dropdown for the recipients and routing modal that is launched when you click on the roles for a template .

Resources