Filenet - GET Username from F_Originator - filenet-p8

I am using filenet BPM for approval system and I want to extract the username from F_Originator so that I can send an email to originator about the status of approved Or rejected document. How can I extract the username from F_Originator in workflow (not using java code)?

I think I found a way to get the username although it's not making use of F_Originator. I created a string field called username & then at the launch step in Assignment tab I assigned username with userid() and it gives you the username. I think its not the best way to get the username but in my case it worked.

Answer suiting to the exact requirement
At launch step, assign output of userid() to a work flow data field
Use OOTB option to send email (CE_Operations) and edit the OOTB templates or
Have a component queue and establish a VWSession (or you can have custom login module to get VWSession)
Call yourVWSession.convertIdtoUserName(int userId) to get the username
then call yourVWSession.fetchUserInfo(username) it returns VWUserInfo
from VWUserInfo you can use getEMailAddress() to get user email id.
Hope this helps

I don't think there is a way to do it in workflow or at least I don't know.
I would suggest you have a component queue like ce_operations and pass the F_Originator and use vwSession.convertIdToUserName(userId)
**************updated answer************
you can use userid() method to get the user who has processed the workflow.
but there is a catch here if there are more than one user involved in processing the workflow, userid() will always return the last user. In order to get the username of the user who launched the workflow try
Define a data field in workflow and assign the value of userid() to it in the launch step
If you are launching workflow from code, you can set the username value to the data field

Related

Slack does not render properly a suer by userID through workflow

Save a userID in a google sheet doc.
Try to push a message in a chat with the userID (read from the doc) but instead of normal #AdamLol I see <#USERID123>.
Can I somehow see the real name?
Since at-handles can change, it's not recommended to rely on them. As such, you have three options in terms of output.
Name
Mention (user ID)
Email
You can pick between these options by choosing from the dropdown beside the variable

Correct way to return REST Api response

I am developing a REST API for a website, let's say i have a POST endpoint('/users/create') which i want to create the user if they don't already exist and return the user as a result.
What this would look like is:
#PostMapping(value = "/users/create")
public User createUser(#RequestBody UserDTO form)
The problem with this is that when the user is successfully created there is no problem just returning the user with a response code 200. The problem comes when I am doing input validation and for example a user with that email already exists and i want to return user: null and some sort of message as to what specifically failed in the user creation. I've thought about multiple posibilities such as creating a custom object that has fields for both an object of any type ( user in this case ) and a message along with it, as well as using HttpServletResponse / ResponseEntity. They all seem like they are overcomplicating something that should be realtively simple in my eyes and i don't know which approach is the best. First time posting so excuse me if i'm a bit all over the place.
there probaly is an solution which uses the Http error system but as an alternative I would use an if statement on both sides, which checks if the user already exists and if it does it sends user:error or something like that. The client side then has to check if the anwser is a user or error and if it is error a pre programmed message is shown

Confirmation of the creation of a record via email in apex Oracle

I have this situation: I have a filling form, there I enter the details of sealing the object, I want to add an interesting function to the form, I want to send an e-mail in order to support the sealing permissions.
For example, I want to seal the doors, in the form I enter the email and press the send button, I receive a normer, which I must enter in the next field in the form, if the number is correct, I see the "create" button, if not, then the "Create" button does not visible
Has anyone already encountered this?
To show (or not) certain items or buttons you can use
conditions
dynamic actions (Show)
In your case, dynamic action might be a better choice.
The part which is related to "if the number is correct" is handled by validation.
If you want to send an email, simplest way is to use APEX_MAIL. https://docs.oracle.com/en/database/oracle/application-express/19.1/aeapi/APEX_MAIL.html#GUID-14F51C6D-CB82-4B38-AB6E-61C46E75596F
For some other options, have a look here: https://jeffkemponoracle.com/2016/04/email-made-easier/
If you want to send an SMS, there is no built-in support for this. You would need to send requests via an SMS gateway. By way of example, an API for integrating with one gateway (ClickSend) which might help you is: https://jeffkemponoracle.com/2016/08/send-sms-mms-and-voice-messages-from-oracle-plsql/

Azure ACS + Form value storage

I'm using Azure ACS in my ASP.net MVC 3 website (hosted in Azure too), the scenario is this:
A user first enters my website and fills a one field form, then they need to chose a provider and login, but first I want to store the field value so when they come back from login I'm able to create a profile with this value for the loged in user.
So I believe when they first enter the site and then leaves to login and enters the site again those are two different sessions am I right? and that's the reason the stored data using session state (through SQL Server) is not present when they come back after login am I right? if this is true what would be the best approach then? if not then I'm doing something wrong storing temp data right?
Thanks
UPDATE:
I have discovered that HttpContext.Application state works keeping the data, still I'm not sure if it's a good idea to use it in a controller considering it's in Azure, will it work on production properly??
You can pass state around in the WS-Federation redirect sequence using the wctx URL parameter. In the action that handles the initial POST request, you should get hold of the form parameter you want to keep, then redirect to you identity provider selection page (this will have to be a custom page) with the form parameter appended to the URL. When the user selects an IP on your page, you can pass the parameter on again using the wctx parameter. The WS-Federation passive requestor profile says that this should be returned to you eventually when the IP redirects the user back to your site.
This has some details
http://msdn.microsoft.com/en-us/library/bb608217.aspx
Edit: To get the wctx parameter out of the request when the user finally comes back to your app. Put something like this in the action code:
var fam = FederatedAuthentication.WSFederationAuthenticationModule;
if (fam.CanReadSignInResponse(System.Web.HttpContext.Current.Request, true))
{
string wctxValue = this.HttpContext.Request.Form["wctx"];
}
My preference is to have the wcxt parameter represent a redirect URL (URL encoded) with your parameter as a query parameter in that so it be a URL encoded version of this:
wctx=https://yourserver/yourapp/yourpage?yourparameter=foo
Then the action that was receiving the redirect from the ACS would simply pull out the value of wctx and do a redirect to it without any more processing. This keeps things simple.
Another approach would be to save whatever data you need to pass around in the Database, and just pass around some ID that refers back to the database record. You'll pass this ID to IP and back through wctx (as Mike mentioned above).
This will solve the issue of limited length of URLs (in case your data is very large). Of course you would need to manage deletion of this data, but this shouldn't be hard.

cakePHP - creating new user account, several problems

I have two tables, users and tokens.
Each user have a activated field and each token have the {id, token, user_id, created} fields.
The way the app should work is:
On the creation, the app will -
make sure that the activated field is empty (to avoid manipulations to the submitted data).
a token will be created in the tokens table.
On update, the app will -
NOT create a new token.
NOT allow an update of any kind to the activated field.
check if a new email has been submitted, and if so: will create a new token and set the activated field to false.
I know how to activate the account through the controller and how to setup the router for that.
What I need is mainly the model configuration.
For example:
I think that the token creation should be done in the afterSave method, so - how do I determine if the method is called by an update or by a create operation?
Thanks for any help
yossi you can also specify the fields that should be saved from the form though - a whitelist of fields it is ok to save in you $this->save() call. That way you can stop a hacker passing an ID in the request, and you should just set it in the controller yourself then with $this->Token->id = whatever you have, I would personally use saveField ('activated) in conjunction with this (just saves a single field!). Fat models is best if you can but get it working first then refactor it if you have got stuck. Better than wasting lots of time writing perfect first time.
You question is unclear. If you have a default value for a field, then why not set it in the database rather than doing something in aftersave? If you need to do something that should be done only in certain circumstances, then write a custom method in your model to perform the tasks you want either on creation or update.
Edit
So, if your record has an id, then you know it exists in the database. So, the simple thing to do is (in any method) check to see if the model has an id field and that it is not empty. If it's empty, then you know that you are creating a record and you can do x task. If it isn't, then do y task.
if(isset($modelData['ModelName']['id']) && !empty($modelData['ModelName']['id'])){
//This is an update
} else {
//This is a new record
}

Resources