Results 1 to 9 of 9

Thread: Delete Note via sugar soap java API

  1. #1
    othmanelmoulat is offline Sugar Community Member
    Join Date
    Dec 2007
    Posts
    22

    Default Delete Note via sugar soap java API

    Hello,

    i'm using sugarcrm soap api to access sugar items from my java application.
    I managed to add note with attachement to sugar item using sugar soap (with java).
    i want to add the feature of overwriting a already existing Note .if this Note already exists, i want to delete it or overwrite it using only sugar soap API and java .
    is that a possible thing to do ? i searched a lot the sugar soap API and didn't found methods to delete or overwrite a Note and its attachment.

    I would appreciate some help in this issue.

    thanks.
    Last edited by othmanelmoulat; 2009-06-07 at 10:57 AM.

  2. #2
    christianknoll's Avatar
    christianknoll is offline Sugar Community Member
    Join Date
    Nov 2008
    Location
    Vienna
    Posts
    939

    Default Re: Delete Note via sugar soap java API

    Use set_entry on the note. If you want to delete the complete note set the delete flag. If you want to remove the attachement set the field file_name and file_mime_type to "".

    that should do it I would assume. If it does not you will need to enhance the SOAP Interface ... which for these simple things should not really be an issue.

    If you just need to delete the relationship of a note that does not work yet. Supposedly 5.5. fixes that. If you want you can look at the oiutlook connector project I am driving where we did enhance the soap interface to also allow deletion of relationships.

    regard, christian.

    Quote Originally Posted by othmanelmoulat View Post
    Hello,

    i'm using sugarcrm soap api to access sugar items from my java application.
    I managed to add note with attachement to sugar item using sugar soap (with java).
    i want to add the feature of overwriting a already existing Note .if this Note already exists, i want to delete i or overwrite itt using only sugar soap API and java .
    is that a possible thing to do ? i searched a lot the sugar soap API and didn't found methods to delete or overwrite a Note and its attachment.

    I would appreciate some help in this issue.

    thanks.

  3. #3
    othmanelmoulat is offline Sugar Community Member
    Join Date
    Dec 2007
    Posts
    22

    Default Re: Delete Note via sugar soap java API

    Quote Originally Posted by christianknoll View Post
    Use set_entry on the note. If you want to delete the complete note set the delete flag. If you want to remove the attachement set the field file_name and file_mime_type to "".

    that should do it I would assume. If it does not you will need to enhance the SOAP Interface ... which for these simple things should not really be an issue.

    If you just need to delete the relationship of a note that does not work yet. Supposedly 5.5. fixes that. If you want you can look at the oiutlook connector project I am driving where we did enhance the soap interface to also allow deletion of relationships.

    regard, christian.
    thank you much for the hint. however when i checked the generated stub classes for java soap api, i noticed the get_entry_list() method actually has a flag 'deleted'. however the set_entry(Session session ,String module,Name_value[] name_value_list) method doesn't have this 'deleted' flag! (as you can see from method arguments)
    i have generated this soap model java classes with wsdl2java client a long time ago so i don't know if the api changed since then. can you please describe me how to call the set_entry() with a flag to delete previous note and overwrite it with new one.
    Also can you please provide a link to your project? is it implemented in java and open source? if yes i would like to have a look at it as i'm very interested in sugarcrm extensions projects in java.

    thanks much

  4. #4
    christianknoll's Avatar
    christianknoll is offline Sugar Community Member
    Join Date
    Nov 2008
    Location
    Vienna
    Posts
    939

    Default Re: Delete Note via sugar soap java API

    set_entry certainly has no delete flag. Pass the delet flag as part of the name_value_list.

    christian.

    Quote Originally Posted by othmanelmoulat View Post
    thank you much for the hint. however when i checked the generated stub classes for java soap api, i noticed the get_entry_list() method actually has a flag 'deleted'. however the set_entry(Session session ,String module,Name_value[] name_value_list) method doesn't have this 'deleted' flag! (as you can see from method arguments)
    i have generated this soap model java classes with wsdl2java client a long time ago so i don't know if the api changed since then. can you please describe me how to call the set_entry() with a flag to delete previous note and overwrite it with new one.
    Also can you please provide a link to your project? is it implemented in java and open source? if yes i would like to have a look at it as i'm very interested in sugarcrm extensions projects in java.

    thanks much

  5. #5
    othmanelmoulat is offline Sugar Community Member
    Join Date
    Dec 2007
    Posts
    22

    Default Re: Delete Note via sugar soap java API

    Quote Originally Posted by christianknoll View Post
    set_entry certainly has no delete flag. Pass the delet flag as part of the name_value_list.

    christian.
    unfortunately this doesn't work . the Note gets entered twice .there are two Note entries and the deleted filed in database table 'notes' isn't set to 1.
    for overwrite i set 'deleted' to 1 and pass it as Integer.toString(1) in the Name_Value list. but this doesn't work. the Note gets entered twice and note is not overwritten.
    i don't know what i'm doing wrong. I would appreciate some further help on this issue.

    the code i use to overwrite an existing note is below :

    Code:
     ArrayList list = new ArrayList();
            list.add(this.make_name_value("assigned_user_id", this.soap.get_user_id(this.sessionid)));
            list.add(this.make_name_value("name", note_name));
            list.add(this.make_name_value("parent_type", pinf.getItemType()));
            list.add(this.make_name_value("parent_id", pinf.getId()));
            list.add(this.make_name_value("description", note_desc));
            list.add(this.make_name_value("deleted", Integer.toString(1)));
    
            Name_value[] arr = (Name_value[]) list.toArray(new Name_value[list.size()]);
    
            noteid = this.soap.set_entry(this.sessionid, "Notes", arr).getId();

  6. #6
    christianknoll's Avatar
    christianknoll is offline Sugar Community Member
    Join Date
    Nov 2008
    Location
    Vienna
    Posts
    939

    Default Re: Delete Note via sugar soap java API

    your call creates a new id ... that is right. To change a note or whatever object you need to pass along which one to change which is by the ID. That is missing as far as I understand your coding.

    christian.

    Quote Originally Posted by othmanelmoulat View Post
    unfortunately this doesn't work . the Note gets entered twice .there are two Note entries and the deleted filed in database table 'notes' isn't set to 1.
    for overwrite i set 'deleted' to 1 and pass it as Integer.toString(1) in the Name_Value list. but this doesn't work. the Note gets entered twice and note is not overwritten.
    i don't know what i'm doing wrong. I would appreciate some further help on this issue.

    the code i use to overwrite an existing note is below :

    Code:
     ArrayList list = new ArrayList();
            list.add(this.make_name_value("assigned_user_id", this.soap.get_user_id(this.sessionid)));
            list.add(this.make_name_value("name", note_name));
            list.add(this.make_name_value("parent_type", pinf.getItemType()));
            list.add(this.make_name_value("parent_id", pinf.getId()));
            list.add(this.make_name_value("description", note_desc));
            list.add(this.make_name_value("deleted", Integer.toString(1)));
    
            Name_value[] arr = (Name_value[]) list.toArray(new Name_value[list.size()]);
    
            noteid = this.soap.set_entry(this.sessionid, "Notes", arr).getId();

  7. #7
    othmanelmoulat is offline Sugar Community Member
    Join Date
    Dec 2007
    Posts
    22

    Default Re: Delete Note via sugar soap java API

    Quote Originally Posted by christianknoll View Post
    your call creates a new id ... that is right. To change a note or whatever object you need to pass along which one to change which is by the ID. That is missing as far as I understand your coding.

    christian.
    Yes Excellent! now it works perfect. Thank you very much for precious help.

  8. #8
    christianknoll's Avatar
    christianknoll is offline Sugar Community Member
    Join Date
    Nov 2008
    Location
    Vienna
    Posts
    939

    Default Re: Delete Note via sugar soap java API

    You are welcome ... always keep in mind that Open Source is a game of give and take ... ;-) ...

    Quote Originally Posted by othmanelmoulat View Post
    Yes Excellent! now it works perfect. Thank you very much for precious help.

  9. #9
    othmanelmoulat is offline Sugar Community Member
    Join Date
    Dec 2007
    Posts
    22

    Default Re: Delete Note via sugar soap java API

    Quote Originally Posted by christianknoll View Post
    You are welcome ... always keep in mind that Open Source is a game of give and take ... ;-) ...
    Yes absolutely ..actually the java application on sugarcrm i'm writing now i will be sharing it as open source so that other people could benefit from the code if they find it interesting.
    i'm always happy to give and not only take
    thanks.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Sugar Soap Server and java apache axis client interop
    By gilberto in forum Developer Help
    Replies: 1
    Last Post: 2011-04-04, 05:42 PM
  2. How to delete records with the Sugar SOAP API?
    By sugarmichael in forum Developer Help
    Replies: 1
    Last Post: 2008-03-12, 09:55 PM
  3. delete Note Attachment via soap API in java
    By othmanelmoulat in forum Developer Help
    Replies: 0
    Last Post: 2008-02-13, 09:23 PM
  4. SOAP API from Java
    By leandro20 in forum Help
    Replies: 8
    Last Post: 2008-01-17, 01:57 AM
  5. Please help SOAP->JAVA
    By pentolino in forum Developer Help
    Replies: 0
    Last Post: 2007-04-20, 11:46 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •