Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 193 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Accessing Other Entities Attributes in Dynamics CRM/365 Forms with javaScript

#1
This function `buttonBuzz()` works inside the Forms of the Entities Account, Contacts and Leads. But not in the Opportunity form.
Mainly because there is no `telephone1` attribute. There is however a Contact entity added with "Quick View" in a section with a telephonenumber inside.

[![View of the Opportunity Form w/ Contact Quick View marked in red][1]][1]

I think it can be accessed with the `telephone1` as well just not with `Xrm.page`

**Any ideas how i can grab the attribute from inside the "quick view"?**

I dont know if the "Quick view" window is a form of an iFrame. And if it is i have no clue how to access it with the `Xrm.Page.getAttribute("telephone1").getValue();`

function buttonBuzz(exObj) {
var phoneNumber;

// Here i store the "telephone1" Attribute from the current .page
phoneNumber = Xrm.Page.getAttribute("telephone1").getValue();

if (phoneNumber != null) { **Sends phonenumber** } ...




[1]:
Reply

#2
Quick Views display data from a record selected in a lookup field, in this case a Contact. You can query data from related records using the OData endpoint.

You first need to get the Guid of the record selected:

var contactId = Xrm.Page.getAttribute("parentcontactid")[0].id || null;

You would then need to send a [SDK.REST][1] request, passing parameters for the Id of the record (`contactId`), `entityName` and the `columns`:

var entityName = "Contact";
var columns = "Address1_Telephone1, FirstName, LastName";

SDK.REST.retrieveRecord(contactId, entityName, columns, null, function(result) {
// Success, logic goes here.
var address1_Telephone1 = result.Address1_Telephone1;
}, function(e) {
console.error(e.message);
});


----------


As well as your JavaScript file, you would need to include the SDK.REST.js file that is included in the [MS CRM SDK download][2] within your Opportunity form libraries.


[1]:

[To see links please register here]

[2]:

[To see links please register here]

Reply

#3
You can pull that field up from the Contact into the Opportunity by creating a Calculated Field, setting it equal to `parentcontactid.telephone1`

Put the field on the form, and you'll be able to `.getAttribute()` it like any other Opportunity field (being Calculated, it updates itself whenever the source changes).
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through