Developer Programs

Learn

Docs

Xp NoteItemAdd Hyperlink

Tutorials > Xp NoteItemAdd Hyperlink

Xperience offers a screen pop for several messages by making a hyperlink call through the Xperience Client Agent (XCA). The NoteItemAdd message is an example XperienceMessageBus message. When the NoteItemAdd message is sent to Xperience, it will display a notification in Xperience.

Here is an Angular example:

Angular example
import { Component } from '@angular/core';
import * as he from 'he';
import { Logger } from '@nsalaun/ng-logger';

@Component({
  styleUrls: ['./hyper-note-item-add.component.scss'],
  templateUrl: './hyper-note-item-add.component.html',
})
export class HyperlinkNoteItemAddComponent {
  private _xmlns: string;
  description: string;
  detail: string;
  instance: string;
  instanceName = '';
  link: string;

  constructor(private logger: Logger) {
    this._xmlns = 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://jackhenry.com/jxchange/JES/2008"';
  }

  // jhaXp:Instance={YourInstanceName}&Msg={YourSerializedMessage}
  createHyperlink(): void {
    if (this.description && this.description.length > 0) {
      // Override the global default setting:
      he.encode.options.useNamedReferences = true;

      if (this.instance && this.instance.length > 0) {
        this.instanceName = 'Instance=' + this.instance + '&';
      }

      const link = he.encode(
        'jhaXp:' +
          this.instanceName +
          'Msg=<NoteItemAdd ' +
          this._xmlns + '>' +
          '<JESMsgRqHdr><JESHdr><AuditWsId>Rex-Wil-Lap</AuditWsId><ConsumerProd>jXchange</ConsumerProd></JESHdr></JESMsgRqHdr>' +
          '<NoteItemDesc>' +
          this.description +
          '</NoteItemDesc>' +
          '<NoteItemDet>' +
          this.detail +
          '</NoteItemDet>' +
          '<EncapAppMsg>' +
          this.link +
          '</EncapAppMsg></NoteItemAdd>',
        {
          strict: true,
        },
      );

      this.logger.log(link);
      document.getElementById('link').setAttribute('href', link);
      document.getElementById('string-link').innerHTML = link;
    }
  }
}

Did this page help you?

Last updated Mon Dec 9 2024