The Infor Communities is globally accessed system by Infor and its customers, please do not post or upload any content that could be deemed as sensitive, confidential or subject to any data regulation requirements. If you are unsure whether or not the content contains sensitive, confidential or has any data regulation requirements, please seek the advice of your internal security, legal, and compliance experts.

Infor M3 Odin 2.2.0 - UserService > getUserContext doesn't not return the correct value of User Context

Hi,

I'm trying to get the user current company and current division by using the userService.getUserContext() method, however the current company id and current division id returned are incorrect.

My default company are 900 and division 100.
The current company name and current division name are correct just the current company-division id has this issue. Below I've attached the code:

import { Component } from "@angular/core";
import { ArrayUtil, CoreBase, IUserContext } from "@infor-up/m3-odin";
import { UserService } from "@infor-up/m3-odin-angular";

@Component({
  templateUrl: "./user-context.component.html"
})
export class UserContextSampleComponent extends CoreBase implements OnInit {
constructor(private userService: UserService) { super("UserSampleComponent"); }
    ngOnInit() {
      this.userService.getUserContext().subscribe((userContext: IUserContext) => {
         this.CONO = userContext.currentCompany;
         this.DIVI = userContext.currentDivision;
      });
   }
}
Here is my current environment:
Here is the user context data returned from method userService.getUserContext():
Could someone help me? 
thanks in advance.
  • Hi Karin,

    Thank you very much for the prompt reply. I've updated the package, tested and it able to return the correct values now.

    For anyone who facing the same issue, follow this step:

    1. Point to your project folder in CMD or Terminal.

    2. Type npm install <packagename>@latest --save
        - get package name here: infor-up

  • Hi ,

    Premise: I use VS Code. The process I use to upload the application is: H5 client -> Administration Tools -> Application -> upload the zip file -> execute the zip file.

    end of premise.


    I'm following the documentation "M3: v13x Programming in the Web Software Development Kit Training Workbook" to write a new application. In order to have a successful run of the application we should include also two folders "Fonts" and "Odin".

    These folders were downloaded from "infor Download Center".

    The getUserContext and MNS150MI API doesn't retrieve the correct Division like YS.

    How can I get the updated folder? 

    Do I need to install all the packages through git? If the answer is yes, is it possible to have a documentation regarding the format to write the code (importing packages, main init, etc), because in the documentation isn't show like YS.

    Thank you in advance.

  • Hi,

    Git has the version 2.0 of the H5 SDK. It's very different from the version 1 and version 2 is more building blocks without a lot of application framework.

    The code you have added is from version 1.

    If you start with a new application now then start with a sample application from the project that is in git and start changing it.

    Building a web application requires previous knowledge of web development, Angular, TypeScript, how to minify and bundle an application etc. First you need to know Angular and web development and then you can move into the specific Infor controls and the services that we have for accessing ION API etc.

    If you don't have that much previous experience starting with a sample and modifying it would be the way to go. But as the SDK does not contain that much UI a lot of the effort is actually spent learning how to use the Infor Design System controls.

  • Hi ,

    We have Infor M3 on premise. Is it okay to use the Git 2.0 ?
    Is the link infor-cloud.github.io/.../ refers only to H5 SDK on cloud?

    I followed the instructions of the link above and I got:

    I think, the procedure to upload the application in M3 is different. Whether not, which folders should be picked?  

    Thanks in advance 100

  • Hi,

    The H5 SDK v 2.0 is for both Cloud and On-prem, but there are some things that does not work with the on-prem version, like calling ION API. On the other hand the H5 SDK 1.0 requires you to run on M3 CE to be able to call ION API so that limitation is the same.

    You need to run the sample with the proxy running so that the proxy will forward calls to M3 MI endpoints. As for which folders to pick you need to build the application an minify all bundles so just picking folders is the wrong way. Check the documentation, https://github.com/infor-cloud/m3-h5-sdk#build