How to set the number sequence for Global Address Book when virtual companies are used

In global address book parameters a number sequence and a company must be selected to use for Global Address Book (GAB) entries.
In our scenario we have 70 companies. We do not have a single company which ALL users have access to, so it seems we cannot pick a company to use for the number sequence.
We also share the number sequence tables through a virtual company, across all 70 real companies.

The result is that we cannot configure Global Address Book. 

This is because users must have access to the company which is used for the Global Address Book number sequence, to be able to create new GAB entries.
Global address book parameters number sequence does not account for sharing of the number sequence tables out of the box.

So as standard it would be necessary to create a company to use for GAB which user’s can access, and set up the number sequence in this company.
In this example as we are sharing the number sequence table (Tables\NumberSequenceTable), so we alreadey have a virtual company which everyone has access to with the number sequences in it, so we will need to change the X++ used to find the next DirPartyId so that it doesn’t try and use a company specific number sequence.
I’ve given a code example for this change below, this is for Tables\DirPartyTable.getNewPartyId():

static DirPartyId getNewPartyId(boolean _throwError = true)
  NumberSequenceReference numberSequenceReference;
  DirParameters dirParameters;
  SysInfoAction_MenuFunction sysInfoAction = SysInfoAction_MenuFunction::newMenuItem(menuitemdisplaystr(DirParameters),MenuItemType::Display);
  NumberSeq numberSeq;
  DirPartyId partyId;
  dataAreaId numSeqCompanyId;
  container dataAreaIdList;
  dirParameters = DirParameters::find();
  numSeqCompanyId = dirParameters.NumSeqCompanyId;
  // START
  // changecompany (numSeqCompanyId)
  // {
  numberSequenceReference = DirParameters::numRefDirPartyId();
  if (numberSequenceReference)
    numberSeq = NumberSeq::newGetNum(numberSequenceReference, false,true);
  if (numberSeq)
    partyId = numberSeq.num();
  // } END
  if (!numberSeq && _throwError)
    dataAreaIdList = [numSeqCompanyId];
    select firstonly crosscompany:dataAreaIdList dirParameters;
    throw error(strfmt(“@SYS53911″,fieldid2pname(tablenum(DirPartyTable),fieldnum(DirPartyTable,PartyId)),enum2str(NumberSeqModule::DIR)),”,sysInfoAction);
  return partyId;

You will also need to make sure that the records you intend to use in Tables\NumberSequenceTable and Tables\NumberSequenceReference have the virtual company’s ID associated with them and not one of the specific companies.
With this change it means that the value in numSeqCompanyId is no longer used so it doesn’t matter what it is.

Comments (0)