locked
XrmServiceToolkit is not defined RRS feed

  • Question

  • Hi,

    I have to create custom entity with XrmServiceToolkit but it gives me error like "XrmServiceToolkit is not defined ".

    Can you have a solution of this error.

    "XrmServiceToolkit is not defined",

    though I have added toolkit


    <script src="Scripts/jquery.js" type="text/javascript"></script>
    <script src="Scripts/json2.js" type="text/javascript"></script>
    <script src="Scripts/XrmServiceToolkit.js" type="text/javascript"></script>
    <script src="Scripts/XrmServiceToolkit.min.js" type="text/javascript"></script>

    Please help me

    Monday, August 3, 2015 12:08 PM

Answers

  • Hi,

    Please either use XrmServiceToolkit or XrmServiceToolkit.min.  Hope you are following folder structure in CRM. It may not be able to find XrmServiceToolkit library.

    Please confirm your HTML web resource name.

    Thanks!

    Kalim Khan

    • Marked as answer by NikkiShah Monday, September 14, 2015 12:00 PM
    Wednesday, August 5, 2015 7:53 AM

All replies

  • Hello,

    First question - why you've added XrmServiceToolkit.js and XrmServiceToolkit.min.js? It is the same library but the second is minimized version.

    Second - please provide your complete scenario - what is your goal, why you've decided to use XrmServiceToolkit e.t.c.


    Dynamics CRM MVP
    My blog

    Monday, August 3, 2015 12:25 PM
    Moderator
  • Thank you for your  reply.

    I have to create custom entity using jquery in microsoft Dynamic CRM 2015 .

    Here is my code 

     var createStudent = new XrmServiceToolkit.Soap.BusinessEntity("Student");
                    createStudent.attributes["name"] = "Test";
                    createStudent.attributes["phoneno"] = "Test Phone No";
                    studentId = XrmServiceToolkit.Soap.Create(createStudent);

    so for that I have to use XrmServiceToolkit.

    I am referring this link:

    https://migsbeja.wordpress.com/2015/02/07/createupdate-entity-using-xrmservicetoolkit-soap/

    https://msdn.microsoft.com/en-us/library/gg509071.aspx?f=255&MSPPError=-2147217396



    • Edited by NikkiShah Monday, August 3, 2015 12:37 PM
    Monday, August 3, 2015 12:33 PM
  • 1. I'm pretty sure that you've used wrong entity name. You should use schema name something like "new_student". The same for attributes - something like  new_name and new_phoneno instead of name and phoneno.

    2. You still haven't described where your code is called from. Is it CRM form or it is html webresource?


    Dynamics CRM MVP
    My blog

    Monday, August 3, 2015 12:42 PM
    Moderator
  • I changed my code as per you suggest,

            var createStudent = new XrmServiceToolkit.Soap.BusinessEntity("new_Student");
                    createStudent.attributes["new_name"] = "Test";
                    createStudent.attributes["new_phoneno"] = "Test Phone No";
                    studentId = XrmServiceToolkit.Soap.Create(createStudent);

    but it still gives the same error.

    and my code is called from html webresource


    Monday, August 3, 2015 12:53 PM
  • 1. I suggested to use new_student, not new_Student. Also recheck that you use correct schema names of field because for me it looks like you are trying to guess right one. I don't have superpowers so just can't guess right schema names for your entities and fields.

    2. Please provide url of your html webresource and url of XrmServiceToolkit.js webresource.


    Dynamics CRM MVP
    My blog

    Monday, August 3, 2015 1:18 PM
    Moderator
  • I want to create new entity so I can use my own schema names of field and schema name of entity.right?.

    URL of html web resource

    https://biztechconsultancy.crm5.dynamics.com//WebResources/new_/createentity?preview=1

    Monday, August 3, 2015 1:25 PM
  • Seems that you've understood possibilities of XrmServiceToolkit in a wrong way. Usage of Create method of XrmServiceToolkit will provide you a possibility to create a records and not entities. To Create entity you will have to use some other approach. For example this - http://mileyja.blogspot.com/2011/05/how-to-create-custom-entity-using.html

    Also you haven't provided full url of XrmServiceToolkit webresource.


    Dynamics CRM MVP
    My blog



    Monday, August 3, 2015 1:35 PM
    Moderator
  • I am really confuse.how can i create entity using javascript and jquery in MS 2015

    According to referece link.

    https://migsbeja.wordpress.com/2015/02/07/createupdate-entity-using-xrmservicetoolkit-soap/

    XrmServiceToolkit  is used for creating entity (in this example).

    and the link you have suggested ,in that which reference is added for user control?

    Tuesday, August 4, 2015 4:50 AM
  • Just for your understanding. Link you are referring describes create or update of record and not entity itself. My link describes creation of an entity. Usage of my link is obvious - copy-paste-troubleshoot-use.

    Dynamics CRM MVP
    My blog

    Tuesday, August 4, 2015 5:13 AM
    Moderator
  • Hi,

    I am fresher so i don't know that XrmServiceToolkit  is used  for creating records not entities.

    Thank you for your support.I saw your link for creating entity.can you give some easy way for that.

    Tuesday, August 4, 2015 8:19 AM
  • What do you mean with "easy way"? There is no magic, only code. To create new entity you will have to create SoapRequest and send it to Soap Endpoint. I'm afraid that this is the only way at the moment.

    Dynamics CRM MVP
    My blog

    Tuesday, August 4, 2015 8:25 AM
    Moderator
  • Hi,

    Please either use XrmServiceToolkit or XrmServiceToolkit.min.  Hope you are following folder structure in CRM. It may not be able to find XrmServiceToolkit library.

    Please confirm your HTML web resource name.

    Thanks!

    Kalim Khan

    • Marked as answer by NikkiShah Monday, September 14, 2015 12:00 PM
    Wednesday, August 5, 2015 7:53 AM