Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Field information its not saved after the record is created

$
0
0

Hello everyone, my name is Taniguchi and i am using Project service on portals, and i am using  ann entity called time entry and to create a record is required for i fill the msdyn_bookableresource field, i created a lookup field to contacts, and coded a odataquery to when i fill the contact field it will auto populate the  msdyn_bookableresource field and the coded worked but when i will create the record appears ann unknown error and the field that was before filled appears enpty.

does anyone know what is happening and how to fix it?

code:

$(document).ready(function(){
   $("#cr14d_contatodoportal").change(function(){
    // Write JS code here
      // Pega os 3 campo do portal pro lookup
      var name = $("#cr14d_contatodoportal_name").val();
      var id = $("#cr14d_contatodoportal").val();
      var entityname = $("#cr14d_contatodoportal_entityname").val();
 
      if (id !== '' && id !== null) {
 
          var GetCustomer = "~/_odata/Contatos?$filter=contactid eq (guid'"+id+"')";
          $.ajax({
              type: "GET",
              url: GetCustomer,
              dataType: 'json',
              success: function (result){
                  //alert('Successfully called');
              },
              error: function (exception) { }
          }).done(function (json) {
              var RecursoId = json.value[0].cr14d_recursosreservveis.Id; // Pega id do gerente json
              var RecursoName = json.value[0].cr14d_recursosreservveis.Name;
 
              if (RecursoId !== null && RecursoId !== undefined) {
                  $("#msdyn_bookableresource").attr("value",RecursoId);
                  $("#msdyn_bookableresource_name").attr("value",RecursoName);
                  $("#msdyn_bookableresource_entityname").attr("value","contact");
                  //$("#emailaddress1").attr("value",ContaId);
              }
          });
    }else{
          $("#msdyn_bookableresource").attr("value",null);
          $("#msdyn_bookableresource_name").attr("value", null);
          $("#msdyn_bookableresource_entityname").attr("value",null);
      }
   });
});


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images