This is a public Forum  publicRSS

Topic

    Padma Prabha Varadarajan
    Browser Control for Asset ObjectAnswered
    Topic posted April 9, 2018 by Padma Prabha VaradarajanExplorer 
    124 Views, 6 Comments
    Title:
    Browser Control for Asset Object
    Content:

    Hi 

    Please tell me whether we can access asset object via javascript in browser control. 

    because in the documentation for javascript API, I couldn't find the Asset object for usage.

     

    Thanks in Advance

    Padma

    Version:
    Service Cloud, Agent Desktop, 17D

    Best Answer

    Edson Junior

    Padma, here are two ideas you can explore.

    #1 If you don't want to use C# Add-In, you can try to use a browser control and pass the Asset.AssetId as a hash, then you can use window.location.hash.split to find the first param.

    Your browser control URL will be something like this. https://<Your URL>#$Asset.AssetId
    And you script code will be something like this.

    
    var objId = window.location.hash.split('#')[1];
    alert(objId);
    
    
    #2 if you want to do this in BUI, you should use getWorkspaceRecordId and your BUI Extension will be something like this.
    ORACLE_SERVICE_CLOUD.extension_loader.load("CUSTOM_APP_ID" , "1")
    .then(function(extensionProvider)
            {
            extensionProvider.registerWorkspaceExtension(function(WorkspaceRecord)
                    {
                            var recordId = WorkspaceRecord.getWorkspaceRecordId();
                            alert(recordId);
                    }
            );
            }
    );
    
    I tested both in my demo environment and it returns the asset Id as an alert.
    Hope this helps.

    Answer

     

    • Rahul Chanda

      Hi, 

      Currently, following Objects are available for usage through Javascript API: 

      1. Contact
      2. Incident
      3. Org
      4. Opportunity

       

      For more information, please refer : http://documentation.custhelp.com/euf/assets/devdocs/unversioned/Connect_Desktop_Integration_JavaScript/Default.htm 

       

      Regards, 

      Rahul

       

    • Padma Prabha Varadarajan

      Hi Rahul

      Thanks for your response

      can you please tell me if this is possible via Agent Browser UI Extensions?

       

      Thanks

      Padma

    • Saravanan Sekar

      Hi Padma Prabha,

       

      As  Rahul Chanda response, currently its supports only those 4 objects.

      I am not sure about your requirement, but you can try the below.

      Get the values from CPHP (Controller) ROQL query which needs to be called from Javascript API (ajax).

       

      Thanks,

      `- S.Saravanan

    • Padma Prabha Varadarajan

      Hi Saravanan

      On Click of a button in Asset Workspace, I want to fetch the record id of that Asset.

      Please tell me how to get that ID without using .net Addin

       

      Thanks

    • Edson Junior

      Padma, here are two ideas you can explore.

      #1 If you don't want to use C# Add-In, you can try to use a browser control and pass the Asset.AssetId as a hash, then you can use window.location.hash.split to find the first param.

      Your browser control URL will be something like this. https://<Your URL>#$Asset.AssetId
      And you script code will be something like this.

      
      var objId = window.location.hash.split('#')[1];
      alert(objId);
      
      
      #2 if you want to do this in BUI, you should use getWorkspaceRecordId and your BUI Extension will be something like this.
      ORACLE_SERVICE_CLOUD.extension_loader.load("CUSTOM_APP_ID" , "1")
      .then(function(extensionProvider)
              {
              extensionProvider.registerWorkspaceExtension(function(WorkspaceRecord)
                      {
                              var recordId = WorkspaceRecord.getWorkspaceRecordId();
                              alert(recordId);
                      }
              );
              }
      );
      
      I tested both in my demo environment and it returns the asset Id as an alert.
      Hope this helps.
    • Padma Prabha Varadarajan

      Hi Edson

       

      Thank you so much for your response, it really helped me a lot. 

      Completed in both the environment. I was stuck up with the Asset object for a longer time

       

      Thanks 

      Padma