Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Fill in Url Field on entity form using odata filtering

Posted on by Microsoft Employee

Hi all,

I am currently experiencing a problem with Odata query. 

I have two custom entities:

1. Custom Configuration entity where are stored Names and Values which another entities can  use. Currently in Name I store the name of URL link and in the Value URL itself.

2.  A Custom entity with custom string filed of type URL.

What I am trying to is to write a function on a custom entity which will via Odata get a configuration entity, filters the name I need and insert's it's Value into this URL field.

But I am getting an error invalid formatType:

Body of the function:

var query = "?$select=csp_Value&$filter=csp_name eq 'puma.link.test'";

XrmServiceToolkit.Rest.RetrieveMultiple("csp_configurationSet", query,

function (results) {

var firstResult = results[0];

if (firstResult !== null) {

xrm.Page.getAttribute('csp_puma').setValue(firstResult);

}

},

function (error) {

Xrm.Utility.alertDialog(error.message);

},

function () {

},

false

);

};

If someone has any hint or suggestions what I am doing wrong please help :)

 

Thank you,

Julia

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Fill in Url Field on entity form using odata filtering

    Hi Clement,

    I am trying to return a string (csp_value) from the custom Configuration entity.

    All fileds are strings  ("single line of text").

    no I dont think that xrm.Page is a problem, I paste it here, but we are using ViewModel. in Visual Studio - so setValue shouldnt be a problem at all.

    But thanks anyway :)

    Regards

    Julia

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Fill in Url Field on entity form using odata filtering

    Hi LeeSwagger, Hi Amritesh Singh,

    I tried it didnt help. The same error message popup occurs :/.

    But thank you for the suggestions!

    Julia

  • Suggested answer
    amritesh Profile Picture
    amritesh 360 on at
    RE: Fill in Url Field on entity form using odata filtering

    Remove the ? symbol and try like this

    var query = "$select=csp_Value&$filter=csp_name eq 'puma.link.test'";

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Fill in Url Field on entity form using odata filtering

    try to do like this:

    var query = "$select=csp_Value &$filter=csp_name eq 'puma.link.test'";

    without ? symbol

  • Clem Profile Picture
    Clem 2,541 on at
    RE: Fill in Url Field on entity form using odata filtering

    Hello Julia,

    What does the odata query returns ?

    What kind of data type is your field ?

    Maybe it's a typo but you wrote "xrm.Page.getAttribute" instead of "Xrm.Page..."

    Clément

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans