Hi,
any body implemented set operations using Sugar CRM Rest API..?
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Hi,
any body implemented set operations using Sugar CRM Rest API..?
Welcome to the forum.
Did you have a problem with some code you forgot to post?
Thread moved from "Whats wrong with my code?"
Please visit the Announcements page for a brief on forum usage, especially number 9.
Thanks for your reply
actually, i wanted to set a relationship between 2 modules of SugarCRM using Rest API. Function name is set_relationship.
here is the code sample
/////Start Java Code
SugarSession session = client.getSugarSession(new SugarCredentials("admin", "admin"));
String moduleName="Accounts",linkFieldName="Contacts";
//First set_entry()
HashMap<String,String> values=new HashMap<String,String>();
values.put("name","TESTsetRelation");
String moduleId= client.setBean(session, moduleName,values);
SugarBean moduleBean = client.getBean(session, moduleName, moduleId);
assertEquals(moduleName, moduleBean.getModuleName());
//Second set_entry()
values=new HashMap<String,String>();
values.put("first_name","TESTsetRelation");
String relatedId= client.setBean(session, linkFieldName,values);
SugarBean linkBean= client.getBean(session, linkFieldName, relatedId);
assertEquals(linkFieldName, linkBean.getModuleName());
SetRelationshipResponse response= (SetRelationshipResponse)client.setRelationship(se ssion, moduleName,moduleId,linkFieldName.toLowerCase(),re latedId);
if (response.getFailed()==1){
throw new Exception("Set Relationship failed.");
}
//////end java code
it shows Created:1,Failed:0,Deleted:0.... as it must be. but the problem is that it doesn't make any relation.
I direct your attention to the link in my previous post, this time just read the whole page. Lets not make someone point out each number on the page.
Wrap your code in tags, and make it easy for us to help you.
Please be specific with the problem you are facing. "it doesn't make any relation" is not a very clear description of the problem. What does the code do? What do you expect?