Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
8 replies Latest Post - ‏2013-10-18T17:17:50Z by BJOwings
BAVI5
BAVI5
52 Posts
ACCEPTED ANSWER

Pinned topic Catch JSON object for initial and in-progress calls

‏2013-10-01T18:00:24Z |

While adding a new document to a document class from Outlook to P8.

In my project i need to catch a single property value entered in the Entry template and populate some property values before pressing "ADD" in the Entry Template.

EDS uses initial and in-progress calls to make these changes. I am using Response filter and not sure how to catch the JSON object to make changes in the getFilteredServices().

 

  • BJOwings
    BJOwings
    185 Posts
    ACCEPTED ANSWER

    Re: Catch JSON object for initial and in-progress calls

    ‏2013-10-01T18:51:26Z  in response to BAVI5

    Hi BAVI5,

    The way you would achieve this is to use a response filter for /p8/openContentClass.  The JSON being returned has a list of property definitions in an array with the key of "criterias".  For the particular property that you want to get control when it changes value insert the field "hasDependentAttributes" with a value of true.

    If that is done correctly, calls to the midtier service /p8/getDependentAttributeInfo should start happening whenever the property changes value and looses focus in the UI.  So, the next step will be to add a response filter for /p8/getDependentAttributeInfo and modify the response to override the current values and cause the UI to update these values.

    With this said, I would suggest trying this with the web client first.  It is easier to see the mid-tier calls and debug the plug-in.  There is also a known issue with the office client and dependent properties that you might run into.  There is a temp fix for that but you won't know if you actually ran into the problem unless you find it works with the web client and doesn't with the office client.

    It would be simpler to use EDS rather than writing a plugin.  You may have mentioned why in earlier posts, if so I apologize.  You might want to avoid making new forum threads so that it is easier to see the history of your appends related to this.  Also, if someone has stated any other limitations in earlier posts that would cause EDS not to work, a plugin will not work around that.

    - Brian

    • BAVI5
      BAVI5
      52 Posts
      ACCEPTED ANSWER

      Re: Catch JSON object for initial and in-progress calls

      ‏2013-10-01T19:19:11Z  in response to BJOwings

      Hi Brain

      thanks for your input I will try this out.

      I am not using EDS for 2 reasons:

      1) I was told EDS has a limitation in ICN 2.0.1 for office, which doesn't allow  to write any outlook property values (even the custom properties). where as i need to write property values based on a property value. 

      2)I need to call a web-service to get the property values that i need to populate

      (If i use EDS i need to write a EDS web-service and call a web-service from it.)

      My goal is to display some text based on the property value. As Navigator for office is not customizable i have changed my requirement to display the text as different property values. Please let me know if there is a much better way to do it.

  • BAVI5
    BAVI5
    52 Posts
    ACCEPTED ANSWER

    Re: Catch JSON object for initial and in-progress calls

    ‏2013-10-02T18:50:47Z  in response to BAVI5

    Hi 

    I am unsure of the JSON structure when we filter for "/p8/openContentClass

    Does the below code follow the JSON structure to change or add the my_property attribute value for dependentAttributes?

    Can you please share a sample JSON structure when we filter for "/p8/openContentClass" and "/p8/getDependentAttributeInfo"

    public void filter(String serverType, PluginServiceCallbacks callbacks, HttpServletRequest request, JSONObject jsonResponse) throws Exception {
     
    JSONObject structure = (JSONObject) jsonResponse.get("columns");
     
    //Catching the criteria and adding a dependency attribute for a property
     
    JSONArray recs = structure.getJSONArray("criterias");
     
    //getting the property array from criteria 
     
    JSONArray properties = recs.getJSONArray("my_property");
     
    //getting the value for a property attribute
    JSONObject column = (JSONObject) properties.get("hasDependentAttributes");
    String Value = (String) column.get("field");
     
    //Setting the property attribute when it is either unavailable or set to a different value
    if ((Value == null) ||  (value.equals("False"))) { // to match a P8 properties
    column.put("hasDependentAttributes", "True");
    }
     
    }
    • BJOwings
      BJOwings
      185 Posts
      ACCEPTED ANSWER

      Re: Catch JSON object for initial and in-progress calls

      ‏2013-10-02T21:28:27Z  in response to BAVI5

      Not exactly right.  Try this:

      int index = 0; // choose the index that corresponds to the property, or search through all the properties to find it
      JSONArray recs = (JSONArray)jsonResponse.get("criterias");
      JSONObject column = (JSONObject)recs.get(index);
      column.put("hasDependentAttributes", true);

      The index is likely not zero, so you probably need to look through the recs array and find the right property.   column.get("name") should give you the symbolic name so you could add a loop looking for the symbolic name of the property you're interested in

  • This reply was deleted by BAVI5 2013-10-08T18:07:23Z. Reason for deletion: Found my answer
  • BAVI5
    BAVI5
    52 Posts
    ACCEPTED ANSWER

    Re: Catch JSON object for initial and in-progress calls

    ‏2013-10-09T00:25:03Z  in response to BAVI5

    Hi Brian

    You told there is a work around to make mu plugin work in NIMO. I tested my Plugin and it is working with navigator but failing with NIMO (navigator for office) on outlook. Any suggestions that could make it work on office (NIMO)? 

    Updated on 2013-10-09T16:51:49Z at 2013-10-09T16:51:49Z by BAVI5
    • BJOwings
      BJOwings
      185 Posts
      ACCEPTED ANSWER

      Re: Catch JSON object for initial and in-progress calls

      ‏2013-10-17T20:27:10Z  in response to BAVI5

      The known issue in NIMO that might be getting in your way is being addressed in APAR IO19685.  The abstract on that APAR is "dependent single value properties are cleared before being transmitted to the EDS servlet".  You should be able to see if this is the case if properties do not have correct values when your /p8/getDependentAttributeInfo filter gets called.   You should contact IBM Support for more help with that issue.

      • BAVI5
        BAVI5
        52 Posts
        ACCEPTED ANSWER

        Re: Catch JSON object for initial and in-progress calls

        ‏2013-10-17T21:00:23Z  in response to BJOwings

        I am unable to view details about APAR IO19685. When i search for it in http://www-912.ibm.com/n_dir/NAS4APAR.NSF/$searchform?Open&view=$$v5r1

         

        Is this issue resolved in NIMO 2.0.2 ?

        Updated on 2013-10-17T21:06:48Z at 2013-10-17T21:06:48Z by BAVI5
        • BJOwings
          BJOwings
          185 Posts
          ACCEPTED ANSWER

          Re: Catch JSON object for initial and in-progress calls

          ‏2013-10-18T17:17:50Z  in response to BAVI5

          I'm not sure why you can't look at the APAR but you can contact IBM Service L2 and they should be able to give you detail on it.  It is not resolved in 2.0.2

  • This reply was deleted by BAVI5 2013-10-17T16:55:33Z.
  • This reply was deleted by BAVI5 2013-10-18T01:03:19Z.