Coming soon: Your brand new Help Center & Community! Get a sneak-peek here

Using personInterestIds - Person Archive Provider

Hi @all,

i am using the ArchiveAgent a lot at the moment and noticed that the supported column "personInterestIds" of the Person archive provider dont work like expected.

https://community.superoffice.com/documentation/sdk/SO.NetServer.Web.Services/html/Reference-ArchiveProviders-PersonArchiveProvider.htm

See the person card with the selected interests here:

And see the output of the script here:

I only get the first selected interest name "Referenz". But i expect either all interest names or persint_id´s.

Should it be like this?

 

See code here:

%EJSCRIPT_START%
<%
  #setLanguageLevel 3;

  String header = "person_id;firstname;lastname;personInterestIds\r\n";
  String rows = "";

  NSArchiveRestrictionInfo[] restrictions;

  NSArchiveRestrictionInfo restrictionAssociate;
  restrictionAssociate.SetName("personAssociate/associateDbId");
  restrictionAssociate.SetOperator(">");
  restrictionAssociate.SetValues(String("0").split(","));
  restrictions.pushBack(restrictionAssociate);

  NSArchiveRestrictionInfo restrictionEmail;
  restrictionEmail.SetName("email/emailId");
  restrictionEmail.SetOperator(">");
  restrictionEmail.SetValues(String("0").split(","));
  restrictions.pushBack(restrictionEmail);

  NSArchiveOrderByInfo[] order;

  String[] entities = String("person").split(",");

  NSArchiveAgent archiveAgent;

  NSArchiveListItem[] archiveRows = archiveAgent.GetArchiveListByColumns("Person", String("personId,firstName,lastName,personInterestIds").split(","), order, restrictions, entities, 0, 1000);

  for (Integer i = 0; i < archiveRows.length(); i++)
  {
    String rowData = archiveRows[i].GetColumnData().toJson().substitute("[I:","").substitute("[D:","").substitute("]","");
    XMLNode xml = parseJSON(rowData);

    String personId = xml.getValueFromPath("personId");
    String firstName = xml.getValueFromPath("firstName");
    String lastName = xml.getValueFromPath("lastName");
    String interestIds = xml.getValueFromPath("personInterestIds");

    rows += personId + ";" + firstName + ";" + lastName + ";" + interestIds + "\r\n";
  }

  print(header + rows);
%>
%EJSCRIPT_END%

 

Tested in SOD.

Best,
Dennis

RE: Using personInterestIds - Person Archive Provider

Hi Dennis,

This has been the case for a long time (always?), but I agree that it is not very logical. The only way to fetch the interests at the moment is by doing extra queries for each result in the archive results.

Af: Matthijs Wagemakers 14. maj 2019

RE: Using personInterestIds - Person Archive Provider

Keep in mind the distinction between a column as an output channel and a column as a restriction channel.
personInterestIds is default Invisible as a GUI column, but visible as a restriction (e.g. find contact/person) where you then get to add interest ids from a list...

/conrad


Af: Conrad Weyns 14. maj 2019