Hi Guys, is there a way to call an Appian function within my Java Code (Smart Se

Hi Guys, is there a way to call an Appian function within my Java Code (Smart Service Plugin)? I need to use todocument() function to convert the input string (ex. "[DocumentId: xxxx]" ) to a document.
Also, once I got the document, I need to get the server path/filename of that file.
Thanks in advance!

OriginalPostID-192788

OriginalPostID-192788

  Discussion posts and replies are publicly visible

Parents
  • Hi jessicae, ContentService can be be used out side of the constructor also. In previous, i have used in constructor, but it can work out side the constructor also. Before using the ContentService, in code we need made some configurtion as per documentation in API.
    Sample Code i used before:
    /* Under Construction */
    public TwitterIntegration(SmartServiceContext smartServiceCtx) {
    /* Step1 */ this.smartServiceCtx = smartServiceCtx;
    /* Step2 */ this.serviceContext = ServiceLocator.getAdministratorServiceContext();
    /* Step3 */ this.contentService = ServiceLocator.getContentService((ServiceContext)this.serviceContext);
    }

    I think you missed Step2 in your code. Because of that you are getting null.

    Code Sample mentioned in API
    Code example (using ServiceLocator and ServiceContext):

    ServiceContext sc = ServiceLocator.getAdministratorServiceContext();
    ContentService cs = ServiceLocator.getContentService(sc);
    Long rulesRootId = cs.getIdByUuid(ContentConstants.UUID_RULES_ROOT_FOLDER);

    If you want more information you can find in API in respected Interface "ContentService".

    Sample Code

Reply
  • Hi jessicae, ContentService can be be used out side of the constructor also. In previous, i have used in constructor, but it can work out side the constructor also. Before using the ContentService, in code we need made some configurtion as per documentation in API.
    Sample Code i used before:
    /* Under Construction */
    public TwitterIntegration(SmartServiceContext smartServiceCtx) {
    /* Step1 */ this.smartServiceCtx = smartServiceCtx;
    /* Step2 */ this.serviceContext = ServiceLocator.getAdministratorServiceContext();
    /* Step3 */ this.contentService = ServiceLocator.getContentService((ServiceContext)this.serviceContext);
    }

    I think you missed Step2 in your code. Because of that you are getting null.

    Code Sample mentioned in API
    Code example (using ServiceLocator and ServiceContext):

    ServiceContext sc = ServiceLocator.getAdministratorServiceContext();
    ContentService cs = ServiceLocator.getContentService(sc);
    Long rulesRootId = cs.getIdByUuid(ContentConstants.UUID_RULES_ROOT_FOLDER);

    If you want more information you can find in API in respected Interface "ContentService".

    Sample Code

Children
No Data