Hello All,
I would like to pass some field values to opportunity from Account by cliking on custom button created on Account. I am not able to pass values I have done below code but not getting desired output.
https://004989-crm-bundle.bpmonline.com/0/Nui/ViewModule.aspx#CardModule...
Like
Dear Amol,
Unfortunately, we are unable to access your code to see how you've implemented the task. However, we are happy to give you some hints for the solution.
In order to recieve some data from another section/detail/page you can use EntitySchemaQuery. Basicly what you need to do is to create a button ( which you've already done), call a method by clicking on the button. In this method cashe the scope (var scope = this) --> create an esq to the Account object --> in the callback obtain the data from the object -->via 'scope.set' set the values to the needed fields.
Please see the article for more information on how to write EntitySchemaQueries:
https://academy.bpmonline.com/documents/technic-sdk/7-8/use-entityschemaquery-implementation-client
and despite the article is about С# usage, it gives more deep understanging of esq usage:
Hi Amol, If I understand what you are requesting is to parse the URL to get the values...try this:
var urlToGetValues= 'https://004989-crm-bundle.bpmonline.com/0/Nui/ViewModule.aspx#CardModuleV2/OpportunityPageV2/edit/6344d6ce-f889-4361-83f2-9cd71dbd6300?Amount=31313'; var ammounfFromURL= urlToGetValues.split('Amount='); // you get on ammounfFromURL[1] the value of amount...
Hi Julio thnx for your reply,
Can u plz tell me how to set a value in callback. I am not able to do that.
Dear Amol,
The probable cause of the issue could be related to not cached scope. Please see the example below. You can transfer it to your OpportunityPageV2 schema for further development:
obtainInfoFromAccount: function() { var scope = this; var esq = this.Ext.create("Terrasoft.EntitySchemaQuery", { rootSchemaName: "Account" }); esq.addColumn("Name"); esq.filters.add("accountName", this.Terrasoft.createColumnFilterWithParameter( this.Terrasoft.ComparisonType.EQUAL, "Id", this.get("Account").value)); esq.getEntityCollection(function(result) { if (result.success) { var item = result.collection.getItems()[0]; var name = item.get("Name"); scope.set("Title", name); } else { return; } }); }
In the example we take account's name and set it to the opportunity title.
Hope you find the example helpful.