web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

How to get territory id in the form of related entity?

(0) ShareShare
ReportReport
Posted on by 96

I have a custom entity as a related of Territory entity. In a new create form of that custom entity, I want to retrieve it's parent (territory) id. In edit mode I can get through url but for create mode it doesn't exist as a query string.

I want to retrieve that territory id using javascript client api.

Need your valuable suggestion.

I have the same question (0)
  • Verified answer
    Marco.P Profile Picture
    2,405 on at

    Hi,

    Refer to this for getting and setting lookup values trough JavaScript:

    www.magnetismsolutions.com/.../how-to-get-and-set-a-lookup-field-using-javascript-in-dynamics-365

    If you need to get the id of the current new record, then you First need saving the record.

    Try something like this:

    Xrm.Page.data.save().then(function(){

    var id = Xrm.Page.data.entity.getId();

    }, function(){

    //handle error here

    });

  • S. Hossain Profile Picture
    96 on at

    Do you think I can get the lokup field without save the form?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 74 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 31 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans