Welcome to Portal

?Unknown\pull-down

Welcome to Zoho Cares

Bienvenido a Soporte de Zoho

Search our knowledge base, ask the community or submit a request.



Hi everyone,

Following our Zoho Creator - Tips and Tricks series every fortnight, we are back today with a tip based on one of the most popular questions asked in our forum. This tip would help you fetch data from another application(App B) and use it in your current application(App A).

Just as your application can send data to other applications, similarly it can easily receive data from other applications. This can be easily achieved in Zoho Creator by creating a custom function in the application(App B) from which you need to fetch data. 

Functions are nothing but a unit of code written to perform a specific task.

Let's look at simple example to understand how to do this.

To explain this I have created two applications: Travel Request and Employee Details. And both of these applications contain a form each to collect data.


The Raise Travel Request Form in the Travel Request Application allows employees to raise request for their upcoming business trips.

The Add Employees Form in the Employee Details Application stores the all the information about the employees in your organization.







Use Case:

Here when an employee uses the Raise Travel Request Form to raise a request for his travel, we need to fetch the employee's Department and his Manager's Email ID from the Employee Details App and use it to auto-populate the fields in the Raise Travel Request Form  based on the Employee Email ID entered.

Step 1: Create a function

To achieve this we need to create a custom function in the Employee Details Application. Navigate to Workflow section and click on Custom Functions. Specify the following arguments to create the following function.




Once you click on CREATE, write the below given Deluge scripts to the function. 

  1. string Getemployeedetails(string Empemail)
  2. {
  3.  empdepartment = Add_Employee[Email_ID == Empemail].Department;
  4.  manageremail = Add_Employee[Email_ID == Empemail].Manager;
  5.  return empdepartment+","+ manageremail;
  6. }

 

Note: This function will return the Employee's department and manager email ID in a format like "Departmentvalue,Manageremailvalue" as a string.

Step 2: Call the function

Now that we have created this function, we need to call this function from the Travel Request Application. By calling the function, we will be able to fetch the required details from the Employee Details Application and autopopulate them in the Raise Travel Request Form.

For this we need to create a workflow On User Input of the Employee Email ID field and write the below given Deluge scripts.
 
  1. datavalue = employee_details.Getemployeedetails(input.Employee_Email_ID);
  2. input.Department = datavalue.getPrefix(",");
  3. input.Manager = datavalue.getSuffix(",");

Note: As we have configured the Getemployeedetails () function to return string value like "Departmentvalue,Manageremailvalue" , we need to use our built-in function getPrefix() and getSuffix() to get the values before and after comma value respectively.

Voila! That's all you need to do to fetch data from another application. Isn't it easy? Give it a try. If you have any doubts or queries regarding this tip, please feel free to add them as comments below. We would be happy to address them all.


27 Replies
Reply
13 more
  • 4 years ago

Hollo, Sejal,

I don't know why below codes returns Null? I tried zoho.books.getRecordsbyID("Salesorders", "XXXXX", "XXXX") and got the same result.

list getSO_Itemlines(string SO)
{
searchParam = {"salesorder_number":SO};
resp = zoho.books.getRecords("Salesorders","XXXXX",searchParam);
items = resp.get("line_items");
info items;
for each item in items
{
info item.get("name");
}
return items;
}

Carson Hu

Thank you! this was really helpful, but what about updating records in other applications?
for example If I change the (tax rate or currency type) in one app it will change it automatically in the second app

  • 3 years ago

Hello Ahmed. I have the same problem. Did you somehow find a solution to update records in another application on succesful form submission in another app?

  • 3 years ago

HI Mark,

Just struggling with the same issue as listed above. The field is a lookup which returns BIGINT.
Could you please confirm where I should add the additional field name in your below solution?
-------
Just add ".[field name]". For example:

Email.Email_Address
Thanks
Christie

  • 3 years ago

Hi there everyone.

I managed to solve the issue of having a lookup field returns as BIGINT and the function requires a string input. When creating your function, specify the argument "examplearguement" as INT.

This allows for the lookup ID (BIGINT) in your field to be inserted into the function to output to STRING.

yay!

  • 3 years ago

Hi all,

Is it possible to fetch image file or a doc file from another application? If yes, then pls help with an example.

Thank you!

  • Zoho MVP
  • 3 years ago

There are a few was to do it:
  1. It's possible to use the API to fetch a file, you would setup an OAuth connection to creator. Then use the invokeURL task to get the file. See:
    https://www.zoho.com/creator/help/api/v2/download-file.html
    https://www.zoho.com/deluge/help/webhook/invokeurl-api-task.html
  2. You could setup a form to receive an email with a file upload field to get the file, in the second app you would use the sendmail task to send an email to the form in the first app. Using the ID of a record as the subject line you could then associate the new record to the form in the first app.
    https://www.zoho.com/deluge/help/misc-statements/send-mail.html
    https://www.zoho.com/creator/help/manage/-how-to-email-form-data.html
  3. Another approach would be to publish the report in the second app and using the invokeURL task in the first app, get the file and save it. After publishing the report you can access it and get the download URL for a file to understand how it is constructed.

  • 2 years ago

Hello, 

Similarly, can i fetch data from external website through API? For instance, the user of form will enter company number and the form will fetch the company details based on that number from another website. Please help. 

  • Zoho MVP
  • 2 years ago

Yes, you just need to build a function to use the external API to supply the data.  It is very much governed by the API of the external site.

  • 1 year ago

Hi,

How do we do the same for subform records?
That is fetching from a subform to another subform in another application. 

thanks 
Richard

  • Zoho MVP
  • 1 year ago

@Richard: You would need to build a specific function in the application you want to grab the data from that would return the subform information in a collection variable, then create the new subform rows by iterating through the collection.

  • 1 year ago

Hi! Do you think it is possible to achieve this functionality in the Creator?
  1. On opening the app, it loads data from Books (recently Shipped Packages). Basically, just one API call.
  2. Using the data, it displays a table with the packages.
  3. Tapping one of the packages will open a form with a signature field and OK.
  4. Signing will add the record of the signature to the Creator (and a reference to the package).
  5. It will also change status of the package to Delivered.
We basically know how to do 3, 4 and 5, and also 1, but how to achieve the 2? How to dynamically build the table? Thank you for any hint!

  • Zoho MVP
  • 1 year ago

@josef's There are a couple of ways to accomplish this, either you could create records for the data, or alternatively you could just create a HTML table and populate it using the data.

Olá, sou novo utilizando o ZOHO CREATOR, estou com dificuldade em desenvolver um código para acessar via API, informações de um site e trazer algumas informações específicas para o CRM, de forma a alimentar meu banco de dados. Poderiam me ajudar nesta construção?

Reply to Sejal DattaniA
/* */
  • 12
  • Insert
  • Plain text
Add Comment
(Up to 20 MB )
    Stats
    9 followers
    27 replies
    17148 views
    Follow

    Subscribe to receive notifications from this topic.