Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8167537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:13:28+00:00 2026-06-06T20:13:28+00:00

I have some Javascript attached to the Service Activity form which fires OnLoad. It

  • 0

I have some Javascript attached to the Service Activity form which fires OnLoad. It retrieves the TechId associated with the Service Case (which is related to the Service Activity) and tries to set the resource for the Service Activity to this user by default.

Screenshot of the unresolved resource

As you can see in the screenshot above, it inserts the correct “name” into the Resources field but it doesn’t seem to resolve it properly as the icon is “corrupt”. If I remove this and manually add the same user, everything is ok. If I try and save this activity as it is in the image, I get an error generated which points to the scheduling engine having problems.

The code I use to set this value is;

function SetTechId()
{
if (Xrm.Page.getAttribute("resources").getValue() == null)
{
    if (Xrm.Page.getAttribute("regardingobjectid").getValue() != null)
    {
        var caseId = Xrm.Page.getAttribute("regardingobjectid").getValue()[0].id;

        var endPoint = getODataEndPoint();
        var odataSelect = endPoint + "/IncidentSet?$select=new_new_fieldtechs_incident/OwnerId,new_new_fieldtechs_incident/OwningUser&$expand=new_new_fieldtechs_incident&$filter=IncidentId eq guid'" +  caseId + "'";

        $.ajax({
               type: "GET",
               contentType: "application/json; charset=utf-8",
               datatype: "json",
               url: odataSelect,
               beforeSend: function (XMLHttpRequest) { XMLHttpRequest.setRequestHeader("Accept", "application/json"); },
               success: function (data, textStatus, XmlHttpRequest) 
                   {
                        if (data.d != null)
                        {
                            var fieldTech = data.d.results[0];
                            var ownerId = fieldTech.new_new_fieldtechs_incident.OwnerId;

                            //because the resources field in the service activity is a partylist, we need to treat this differently
                            var partylist = new Array();
                            partylist[0] = new Object();
                            partylist[0].id = ownerId.Id; //Guid (i.e., Guid of User or Contact etc)
                            partylist[0].name = ownerId.Name; //Name (i.e., Name of User or Contact etc)
                            partylist[0].entityType = "account"; //entity schema name of account or contact

                            Xrm.Page.getAttribute("resources").setValue(partylist);
                        }
                   },
               error: function (XmlHttpRequest, textStatus, errorThrown) { }
        });
    }
}
}

function getODataEndPoint() {
return Xrm.Page.context.prependOrgName("/xrmservices/2011/OrganizationData.svc"); 
};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T20:13:29+00:00Added an answer on June 6, 2026 at 8:13 pm

    Is “Tony Harley” really an account or is it a systemuser?

    partylist[0].entityType = "account"; //entity schema name of account or contact
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have attached some javascript on onload event of the form. this script contains
I have an Image, which is attached to some JavaScript on MouseEnter. This all
I have added a custom form on the opportunity entity and have some javascript
I have a little javascript function which is attached to an onClick event of
I have some javascript where I append an option to a select: var myuniqueddl
I have some javascript code with do while outer loop and switch inner loop,
I have some javascript applying changes to some elements and a function loading more
I have some javascript that I am using for some audio on my website:
I have some javascript that goes out and fetches a javascript class on another
i have some javascript roll over code that works fine in firefox but when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.