Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: How to update the vendorClientCorportion from a field interaction? #1391

Open
Hunter-adam-haydon opened this issue Feb 10, 2023 · 1 comment
Labels
requires discussion This issues needs to be reviewed before development can start

Comments

@Hunter-adam-haydon
Copy link

I am trying to update the vendorClientCorportation id from a customText field using the API bridge but not sure where I am going wrong or whether this is the best way of doing it?

var placementId = API.currentEntity;
var venderClientCorporationid = API.getValue('customText42');
var item = {"venderClientCorporation" : {"id": venderClientCorporationid}};
API.appBridge.httpPUT("entity/Placement/" + placementId, item);

Many thanks for the help
Best
Adam

@Hunter-adam-haydon Hunter-adam-haydon changed the title Question: How to update the vendorClientCorportion from a field integration? Question: How to update the vendorClientCorportion from a field interaction? Feb 10, 2023
@davidkbh
Copy link
Collaborator

Several issues; First, API.currentEntity gives the name of the current entity type; in this case, that'd be "Placement". You probably want API.currentEntityId.

Second, while it's common for REST requests to go the other way, for appbridge it uses httpPOST requests to update existing entities, and httpPUT to update them.

Last, there's a typo; it's "vendorClientCorporation", not "venderClientCorporation"

Full fix would be:

var placementId = API.currentEntityId;
var vendorClientCorporationid = API.getValue('customText42');
var item = {"vendorClientCorporation" : {"id": vendorClientCorporationid}};
API.appBridge.httpPOST("entity/Placement/" + placementId, item);

@michael-amaya-bh michael-amaya-bh added requires discussion This issues needs to be reviewed before development can start and removed question labels Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
requires discussion This issues needs to be reviewed before development can start
Projects
None yet
Development

No branches or pull requests

3 participants