Just giving you
So⊠does that mean only UpdateExt works and not Update for this? (I used update for creating the user.)
No I used Update in the widgets and in my straight code
Huh. Well I must have something else random wrong, or it just doesnât like me passing the new dataset straight into the update.
Anyway, itâs possible and simple enough, so thank you all.
Can confirm that it works with reset too
this.CallService<Ice.Contracts.UserFileSvcContract>(uf => {
var dsUf = uf.GetByID(iUserName);
if(iEnabled)
{
dsUf.UserFile[0].ClearPassword = true;
dsUf.UserFile[0].PasswordBlank = true;
dsUf.UserFile[0].PwdExpiresDays = 0;
dsUf.UserFile[0].PwdExpires = DateTime.Today;
dsUf.UserFile[0].PwdGrace = 3;
}
dsUf.UserFile[0].UserDisabled = !iEnabled;
dsUf.UserFile[0].RowMod = "U";
uf.Update(ref dsUf);
});
Security Man saysâŠ
Should have listened to this earlier, I guess.
Iâm still not getting any version of UPDATE to work
- Not in a widget Function
- Not in a code Function
- Not in Swagger
BUT⊠UpdateExt does work in Swagger, I think because it has that continueProcessingOnError
option (that I set to true
).
I assume that allows it to move on and finish the job.
I mean, if I have to manually enable the users, I guess thatâs not the end of the world. But itâs so close!
I wonder if itâs version specific. If you used my code as is it should work if not then there is something different between 2021.2 and 2022.2 in regards to the UserFile BO. Itâs possible you might need to use Erp vs Ice in that version since user lives in both halves, sort of.
Are you first doing the RowMod = âAâ to make sure the record exists and THEN enabling with the RowMod = âUâ - much like the process in the UI?
Good point, I have been wondering about that, but have not tried anything but Ice.
True, I might give this a whirl in 2022.2.
I mean, no⊠I donât see that in the trace anywhere.
Also, I may be confused â youâre talking about just the enable-user process? Not creating a user, right?
First create the user with all the things. Add it. With that dataset, set disable = false and then update.
Looking at the error above, there is no SysRowID and you wonât get that until you add the record first.
That was my original flow, but it only works to create the new user, never successful to enable.
Iâll call it for today. About time to check for missing shingles. Itâs not bad here.
@josecgomez Hope you are staying safe, too. Iâm guessing so since you replied earlier.
And for anyone here in the Southeast US.
So i am creating a new user in a function before this. then calling the enable one once the account it added. I have the stuff setup exactly as you have it written @jgiese.wci and Iâm on 2022.2.16. But when i run the enable user code it tells me this error
I have a feeling the dataset is empty. but not sure. Are you available to help with this?
{
âHttpStatusâ: 500,
âReasonPhraseâ: âREST API Exceptionâ,
âErrorMessageâ: âObject reference not set to an instance of an object.â,
âErrorTypeâ: âSystem.NullReferenceExceptionâ,
âCorrelationIdâ: â20121c0f-2ec5-41d5-b52f-8e94e4dc5f98â
}
What is your full code base on this? My guess is you might need another GetByID call added in there after saving the new user vs using the existing dataset.
What you have typed i have in a 2nd widget function and i have the create user in another one using widgets. The screen shot below shows how i am creating it. Then i use your method to get the userid and enable it.
this.CallService<Ice.Contracts.UserFileSvcContract>(uf =>{
var dsUf = uf.GetByID("Rick.Draeger");
dsUf.UserFile[0].UserDisabled = !dsUf.UserFile[0].UserDisabled; //Toggle User
dsUf.UserFile[0].RowMod = "U";
uf.Update(ref dsUf);
}) ;
Another reason I hate widgets I canât read the full story itâs like reading a book like this
Sorry going to be touch and go trying to debug it as widgets via the forum. If there are in different function calls and you are getting the data each time it should work fine.
I would advise against using the Alpha POC code I posted that will toggle the user on and off. If this is part of a creation script code it more on these lines
this.CallService<Ice.Contracts.UserFileSvcContract>(uf => {
var dsUf = uf.GetByID(iUserName);
dsUf.UserFile[0].ClearPassword = true;
dsUf.UserFile[0].PasswordBlank = false;
dsUf.UserFile[0].PasswordEmail = "someuser@somesite.edu";
dsUf.UserFile[0].PwdExpiresDays = 0;
dsUf.UserFile[0].PwdExpires = DateTime.Today;
dsUf.UserFile[0].PwdGrace = 3;
dsUf.UserFile[0].UserDisabled = false;
dsUf.UserFile[0].RowMod = "U";
uf.Update(ref dsUf);
});
oh okay looks like im still not getting any data when running this function specifically in postman.