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

Announcements

No record found.

News and Announcements icon
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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 101 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 83

#3
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 69 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans