Issue while inserting the user in liferay - liferay

I have created a form which has basic user details and on clinking of the Save button I am inserting the user details in the "USER_" table by calling the UserLocalServiceUtil.addUser(....). Now the user is creating with out any issue. But I am not able to see some form field parameters in UserLocalServiceUtil.addUser(....) method like (Title, Gender and Date Of Birth). Now how can I save this values. Please give me some suggestions that how can I insert the following fields (Title, Gender and Date Of Birth) at the time of user creation.

Liferay uses com.liferay.portal.model.Contact entity to store the contact information.
Use com.liferay.portal.service.ContactLocalServiceUtil.addContact method to create the contact. Significant parametres:
userId - Id of the user that is creating the contact. You can use PortalUtil.getUser method to get the current user from a request.
className - "com.liferay.portal.model.User".
classPK - Id of the new user that the contact is created for.

Related

How to add new fields to the documents downloaded for odoo 15?

I have a type of document and I want to give it more details than it's given in the document model.
By default, I have only these fields (Name, Contact, Owner and tags) as shown below :
My question is how I can add more fields like ID, Organisation, Date,etc.
Thanks a lot.

[Strapi v4]: How to GET content created by a particular user in Strapi CMS

I have a use-case of retrieving content that is created by a particular user. Whenever I try GETng it, I am getting all the data created by different user.
Scenario 1:
I have an admin user. I created a content type of stock-list with name and description field.
I created 5 rows of data as per stock-list content type.
Scenario 2:
I have another user say testA.
I have created 4 rows of stock-list content by logging in as testA.
Now I wanted to retrieve stock list created by userA. Supposing I have a public endpoint for getting GET /stock-lists, how can I GET that ?
Currently when I am firing GET /stock-lists, I am getting all the data created by admin and testA user combined.
Can anyone help ?
does the stock list have a relationship with a user.if not make a relationship of one user having many stocks then you can make a query by finding all the stocks with a specific user.

Achievement/Badge System

I'm currently working on a website and I have used PostgreSQL, Express and Node.js technologies to make it.
I want to make an achievement system that is event based. E.g. a user makes a new post and is awarded an achievement/badge for making the first post. I was wondering what the code logic behind this would be? How do I award the user when first post is made? And the next time when user makes a new post again (second post) check if the user already has the achievement/badge for making the first post and just continue without awarding the achievement/badge again?
My database tables
The badges table looks like this:
id name description icon created_at updated_at
user_badges table
user_id
badge_id
created_at
updated_at
users table
id name etc...
Any help would be much appreciated.
You shoould have one user table that will store user data and with that you should have an column like totalQaAsked or badgeGiven like this
user's table
username, userFullName, userLoggedIN, totalQaAsked, badgeGiven
At the first time totalQaAsked would be 0 so badgeGiven would be false when user ask his first question then you should have one table that will track question asked by the user and check weather this the first question asked by the user then it will update user's table with totalQaAsked+1 and badgeGiven=true. now you'll have user's data every time you proceed then you can check easily.
Question's table
username, question, some more columns
2nd Method
You can directly query from question with user's id and check how many question asked by the user then you can give badge according to it.

Extend Endpoint to show Created By User ID

I need to be able to see the Created By and/or the Last Updated By User ID's for a Document or Transaction (example Inventory Receipt). How can I add these fields to my extended Web Services Endpoint as these fields are not showing up in the list of DAC fields for this entity? Note that I have the same issue on other entities.
The field doesn’t show up on the list because it doesn’t have a PXUIFieldAttribute / is not visible on the page, but you can still type the underlying field name directly when adding it to the endpoint.

Using Graph API to query SharePoint list items and expand user field

I'm trying to query for some SP list items, all is working fine except I can't seem to expand a custom column of type Person.
I can see the createdBy and lastModifiedBy expanded and even includes the AAD user id, which is great and also leads me to think what I want is possible!
But mine is a custom column.
I'm running this and can only seem to get the SP user list id and the user's display name...neither of which are much use.
/items?expand=fields(select=UserLookupId,User)
Ideally I'd like to get the AAD user id as per createdBy and modifiedBy field, but the email would suffice.
Otherwise the only way I can see is to query the User Information List (using the UserLookupId) to get the email?
Thanks
This appears to be correct assumption:
Otherwise the only way I can see is to query the User Information List
(using the UserLookupId) to get the email?
for non-system user fields, it is indeed a way to go, but there are some distinctions whether user field is multi-valued or single-valued.
If Approvers is a multi-valued user field, then the following query:
https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?$expand=fields($select=Approvers)
returns email and id properties along with displayName property for user field value.
While for single-valued user field only id (available via {userfield}LookupId property) and displayName properties could be requested via items endpoint, for example:
https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?$expand=fields($select=Approver,ApproverLookupId)
So, indeed User Information List needs to be utilized to request additional user properties, for example:
https://graph.microsoft.com/v1.0/sites/root/lists('User Information List')/items/{item-id}/?$expand=fields($select=Email)
where item-id corresponds to user field lookup id
This was my experience modifying the
Build Angular single-page apps with Microsoft Graph. In the examples below, I changed my id's out with the default text.
Here is
The Finished Project on thier github
In Graph Explorer, this worked. You can verify it at the Microsoft Graph Explorer.
https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?expand=fields($select=id,Title)
In the app/graph.service.ts in the app, this did not work. Even though you would expect it to based on the graph explorer.
.api('/sites/{site-id}/lists/{list-id}/items?fields($select=id,Title)')
Changing the app/graph.service.ts api call worked.
.api('/sites/{site-id}/lists/{list-id}/items?')
.expand('fields($select=id,Title)')
The result looked like this:
fields: {
#odata.etag: ""d6f5b6ea-9f90-452d-98ba-e838f58d3359,1"",
Title: "IT SPECIALIST (MID)",
id: "20"
}
Here's an example site id:
some.sharepoint.com,9dk062b-2e54-4e4f-b71a-cdb74f42cc44,c6cf6b0a-cc7c-41fd-a76a-ef8f97e8a22f
Here's an example list id.
8eg8c29a-5555-4cfc-bfa4-0e907488f781
The end url won't have any {} in it.

Resources