Home Self-Service Portal - Community

How do you display current contact details in Request Offerings like in the User Settings page?

Hello,

I am wanting to display users current contact details as they are filling in a Request Offering form.
Just like they are displayed in the User Settings page. 
Is this possible?

Thanks

Answers

  • seth_coussensseth_coussens Member Ninja IT Monkey ✭✭✭✭
    This is possible, but would need to be done in javascript using the custom.js file. You would need to target the request offering url with the ID you are looking for and then dynamically add the html you want to use to display the information.

    The current users information is already available  as a javascript global variable in the 'session.user' variable
  • Ryan_KennedyRyan_Kennedy Customer IT Monkey ✭
    I have used session.user to get several values such as FirstName , LastName , Id however I am unable to find values for Phone / Mobile Phone .. Also not sure how to target the request offering with the url / put this information into one of the fields in the Service Request. Is anyone able to help out with this / show me an example of it? Thanks.
  • Ryan_KennedyRyan_Kennedy Customer IT Monkey ✭
    Does anyone have any examples they could share?
  • Ryan_KennedyRyan_Kennedy Customer IT Monkey ✭
    Okay, I've managed to get this to work now using the session.user variable but doesn't seem like there is much information available .. I can get
    1. Company:
    2. Domain:
    3. Email:
    4. EmployeeId:
    5. FirstName:
    6. Id:
    7. LanguageCode:
    8. LastName:
    9. Name:
    10. PrincipalName:
    11. Title:
    12. UserName:
    But can't get other details that are on the User Settings page like

    1. telephoneNumber:
    2. facsimileTelephoneNumber:
    3. streetAddress:
    These seem to be under pageForm.jsonRaw that is only available on the User Settings page.

    Is there a way to get this information available on a separate page?
    Or a way to get this information into session.user?

    Thanks
  • Martin_BlomgrenMartin_Blomgren Customer Ninja IT Monkey ✭✭✭✭
    Hi @Ryan_Kennedy

    You need to use Cireson API if you cannot find what you need in the global session variable or pageForm/viewModel!

    Userinfo with related workitems:
    $.getJSON('/api/V3/User/GetUserRelatedInfoByUserId', <br>{ "userId": session.user.Id }, <br>function (data) {<br>&nbsp;&nbsp;&nbsp; doSomethingWithInfo(JSON.parse(data));<br>});<br>function doSomethingWithInfo(userInfo) {<br>&nbsp;&nbsp;&nbsp; // do something with u object<br>&nbsp;&nbsp;&nbsp; console.log(userInfo);<br>&nbsp;&nbsp;&nbsp; ...<br>}


    Only userinfo:
    $.getJSON('/Search/GetObjectProperties', <br>{ "id": session.user.Id }, <br>function (data) {<br>&nbsp;&nbsp;&nbsp; doSomethingWithInfo(JSON.parse(data));<br>});<br>function doSomethingWithInfo(userInfo) {<br>&nbsp;&nbsp;&nbsp; // do something with u object<br>&nbsp;&nbsp;&nbsp; console.log(userInfo);<br>&nbsp;&nbsp;&nbsp; ...<br>}

  • Ryan_KennedyRyan_Kennedy Customer IT Monkey ✭
    Awesome - thanks heaps for that :)
    I have it all working now besides displaying who the users manager in AD is.
    Is there a way to display the users manager in the forms?

    Thanks
Sign In or Register to comment.