我目前有两个列表,一个来自外部API(SPLYNX),该列表返回所有客户列表,另一个列表返回Zoho CRM中的Contacts Module的所有帐户名称的列表,目前,我只想编写一个代码,该代码确认两个列表是否包含匹配条目(例如,Splynx列表中的一个条目与CRM列表中的另一个条目匹配)。
我实际上要实现的目标是每个匹配条目,我想通过SPLYNX的客户ID字段更新CRM记录,并在CRM中的帐户模块中使用一个自定义字段称为Splynx ID(因为此ID是自动生成的,以维护以维护两个应用程序之间的一致性)。我想知道这是否可以实现。
是我到目前为止写的代码
headersmap = Map();
headersmap.put("Authorization","Basic xxxxxxx);
response = invokeurl
[
url :"https://selfcare.dotmac.ng/api/2.0/admin/customers/customer?"
type :GET
headers:headersmap
];
AccountlistSplynx = List();
li1 = List();
li2 = List();
li3 = List();
rows = response.toJSONList();
rows1 = response.toJSONList();
rows2 = response.toJSONList();
for each row in rows
{
Name = row.getjson("name");
AccountlistSplynx.add(Name);
}
for each row in rows1
{
Address = row.getjson("street_1");
li1.add(Address);
}
for each row in rows2
{
CustomerID = row.getjson("id");
li2.add(CustomerID);
}
Accountlistzoho = List();
mp = Map();
contacts = zoho.crm.getRecords("Contacts");
for each contact in contacts
{
account = ifnull(contact.getJSON("Account_Name"),Map());
if(account.size() > 0)
{
accountname = account.getJSON("name");
Accountlistzoho.add(accountname);
}
}
if ( Accountlistzoho == AccountlistSplynx )
{
info "Matching records!";
}
else
{
info "No matching records!";
}
这 帐户
I currently have two lists, one is from an external api (splynx), which returns a list of all customers, and another list which returns a list of all Account names from the contacts module in Zoho crm, at the moment, I just want write a code that confirms if the two lists contain matching entries (like one entry in the splynx list matches another entry in the crm list).
What I actually want to achieve is for each matching entry, I want to update crm records with the Customer ID field from Splynx, with a custom field called Splynx ID in the accounts module in CRM (because this ID is auto generated so as to maintain consistency across both apps). I want to know if this even achievable.
This is the code I have written so far
headersmap = Map();
headersmap.put("Authorization","Basic xxxxxxx);
response = invokeurl
[
url :"https://selfcare.dotmac.ng/api/2.0/admin/customers/customer?"
type :GET
headers:headersmap
];
AccountlistSplynx = List();
li1 = List();
li2 = List();
li3 = List();
rows = response.toJSONList();
rows1 = response.toJSONList();
rows2 = response.toJSONList();
for each row in rows
{
Name = row.getjson("name");
AccountlistSplynx.add(Name);
}
for each row in rows1
{
Address = row.getjson("street_1");
li1.add(Address);
}
for each row in rows2
{
CustomerID = row.getjson("id");
li2.add(CustomerID);
}
Accountlistzoho = List();
mp = Map();
contacts = zoho.crm.getRecords("Contacts");
for each contact in contacts
{
account = ifnull(contact.getJSON("Account_Name"),Map());
if(account.size() > 0)
{
accountname = account.getJSON("name");
Accountlistzoho.add(accountname);
}
}
if ( Accountlistzoho == AccountlistSplynx )
{
info "Matching records!";
}
else
{
info "No matching records!";
}
I also want to know if this is the best route to follow in trying to achieve this because I had already imported these contacts from Splynx to CRM before I realized that I did not create the custom field for Accounts
发布评论
评论(2)
查看Intersect列表功能:
Note!:
应该
返回相同的相交集,但有时其中一个呼叫返回较小的集合。要围绕此操作,请调用Intersect()两种方式,如果它们不同,请使用提供预期集的一种。
对于此任务,将使用类似的东西:
Take a look at the intersect list function:
Note!:
and
should return the same intersection set but sometimes one of these calls returns a smaller set. To work around this, call intersect() both ways and if they differ use the one that gives the expected set.
For this task intersect() would be used something like this:
关于您的需求,如果在Splynx记录中匹配Zoho CRM记录,是否要更新Zoho CRM记录?
步骤1:
将所有SPLYNX记录存储到销量中的列表数据类型变量中。
将所有ZOHO记录存储到列表数据类型变量中。
步骤2:
假设这两个列表的API字段名称都不均等匹配。
步骤3:
如果我们假设该帐户名称是匹配的标准,那么这就是确定Zoho记录中匹配的记录的方法。请注意,API_FIELD_NAME或键与您的实际数据不同。
您可以在 https://deluge.zoho.com/tryout 中尝试此洪水脚本。
请参阅此链接有关如何更新Zoho Records
Regarding your needs, do you want to update Zoho CRM records if they are matched in Splynx records?
Step 1:
Store all Splynx records into the List data type variable in the deluge.
Store all Zoho records into the List data type variable in the deluge.
Step 2:
Assume that API field Names of both Lists are not equally matched.
Step 3:
This is how to determine matched records in Zoho records if we assume that Account Name is the criteria to be said it is matched. Please note that api_field_name or keys will be different from your actual data.
You can try this deluge script in https://deluge.zoho.com/tryout.
Please refer to this link on how to update Zoho Records https://www.zoho.com/deluge/help/crm/update-record.html