This is a public Forum  publicRSS

Topic

    Saravanan S
    How to use ROQL in Javascript API
    Topic posted January 24, 2017 by Saravanan SSpecialist 
    49 Views, 10 Comments
    Title:
    How to use ROQL in Javascript API
    Content:

    Hi All,

     

    My Scenario is to restrict the user from creating the similar record(combination of two fields should not be same) in custom object.

    My Idea is to use Java script API(Browser control), with this I can get the values from work space(action=create) and compare it with the previous record using ROQL and then showing the popup in ws.

    My Problem is I cant use ROQL inside the java script.

    How to use ROQL in javascript?

    Snippet of my code is attached here.

    Kindly help me in this.

    Thanks,

    S.Saravanan.

    Version:
    Aug 16
    Code Block:

    Answer

     

    • Barrilito

      Hi Saravanan.

      Without looking at your code in much detail, why do you want to use roql? You can query the object with the javascript api, correct?

      But the answer in general is "no you can't use roql"

      Regards

    • Dietrik

      Where did you get that code snippet ?

    • Saravanan S

      Hi Barrilito,

      I always using CPM code to achieve other functionalities, but this is my first javascript API, 

      Thanks for your answer @Barrilito.

      @dietrik

      Code is created by my own with the help of documentation. Kindly correct me.

       

      Thanks,

      S.Saravanan.

    • Saravanan S

      Hi Barrilito,

       

      Can you please help me to query using Javascript.

       

      Thanks,

      S.Saravanan

    • Barrilito

      Hi,

      Perhaps you should break down the problem in more easy parts.

      First try to add a new tab to your workspace with a simple page where you use the javascript api that only looks up the object and prints something on the screen. If you look into the documentation it is described well how to call a custom object.

      If you got that to work, then try to compare it with some other data. Makes sense?

      Regards

    • Saravanan S

      Hi,

      But if I can access the data using ROQL its much easier to me.

      Okay I will go through the documentation.

      Thanks,

      S.Saravana

    • Barrilito

      If I let my neighbour write the code for me it is also easier wink

      Sometimes it is not about easy or not, but what is the proper solution and what is available or not.

      Good luck Saravanan!

      Regards

    • Saravanan S

      Ha ha ha,

      Yeah Sometimes only Gurucool, I will do with proper way.

      Thanks,

      S.Saravana

    • Barrilito

      Great! laugh

      Regards!

    • Rajan Davis

      You could probably use the javascript API to read the values from the workspace and use AJAX to make a GET request to a custom controller/CPM that takes the values, does a look up with ROQL with those values, returns a result, and then you use the javascript API to handle the returned result.