Website "you can do this" script - database

I want to create a training path for new users accessing my site. This training path must display info bubbles showing what you can do on every page, but only the first time you access it.
So, for example, if a user enters a page where there's an edit button an info box should appear next to the edit button telling the user that he can edit that page.
I will create the script myself, I just want to know what's the best method to check if the user has already seen that box or not. I was thinking about storing in database a boolean value for each info box which will be set to true if the user has seen the box. To save some queries from the DB I think I can also store the same values in localStorage or in Cookies.
What is the best practice for creating user training paths for a website?

The way I suggest is to store user id (ip or username ? ) and a bit value for each bubble like you say.
PS: for your script you can use this:
http://www.maxvergelli.com/jquery-bubble-popup/documentation/
Jérôme

Related

Salesforce Screen flow search and display record information

I'm working on a screen flow. The idea is to have a lookup component the user can search a contact. Then I would like to display the information from the Contact (Account Name, Contact Name, Number Email) and I would like to be able to have the user update that information if needed. I just stomped on how it can be done. I know it should be able to be pulled from the record ID in some type of way and maybe use an Assignment to display the information. Can someone guide me on a next step or if anyone has an instructional video would be helpful.
Thanks
You wouldn't be able to display the looked up contact's fields on that screen as soon as you populate that field. That would be something only possible in code (aura component or lwc).
What you can do, however is -
Get Record element after that screen element. (Get Contact, where Id = lookupcomponent.recordId)
Then EITHER:
use the new Fields (BETA) option on another screen Fields (BETA)
(this method is easier, doesn't have as much control and is limited on fields, depending on data type, you can use)
add inputs one by one and set the default values Add Fields One By One
(this method allows more control)
Then, you will need an update element. If you used the Fields (BETA) you can just update the record variable. If you did the inputs one by one, you will need to update the contact and set fields individually.
Full Flow Example

How to save a recordset without overwritting existing records with Cakephp 3

Is there an easy way to save a recordset, i mean multiple records, but only the "new ones"?
I have a table users and a users form in the view. First field you must enter is passport number, so if user already exists in database the rest of the form will be auto completed and disabled to prevent changes but if passport dont exist then you have to enter all data. As anyone can change those existing users data controls from the browser even if they are disabled, i want to make sure only new records are saved in database. First of all i thought i could find again in database and delete existing users from recordset before save, but i wonder if there is a more elegant approach.
Ty in advance.
I write this here, cause comments are too short:
Thank you for your answer, André. I'm sorry if i didnt explain perfectly, but the form is done by disabling all controls except passport and if passport dont exist (i check it on passport focusout) then the rest of controls are set to enabled. I mean, that is already done. The question was only about the saving.
The validation method you talk about, well i'm actually validating all the controls in the form and i must disable the 'unique' rule so a user can link an existing user to the current bill, otherwise it will fail validation on submit and it wont allow the user to proceed (i did this because it happened to me when testing). The actual setting is much more complicated: the form belongs to a model (bills) which is associated with 4 other models and 2 of those relationships are many to many, bills_users and bills_clients, where users are the persons who do the job and clients pay for it, but I was trying to make the question easier. Anyway, what I am looking for is, in fact, some kind of saving setting which I can't find. In documentation I found "When converting belongsToMany data, you can disable the new entity creation, by using the onlyIds option. When enabled, this option restricts belongsToMany marshalling to only use the _ids key and ignore all other data." The first half of the sentence was promising, but the explanation says different, and I actually tried it without success.
First:
Is there an easy way to save a recordset, i mean multiple records, but only the "new ones"?
Yes there is you can validate it in model, something like this:
public function buildRules(RulesChecker $rules)
{
$rules->add($rules->isUnique('passportNumber'));
return $rules;
}
This will prevent to save a duplicate passport number register, but you can different.
I have a table users and a users form in the view. First field you must enter is passport number, so if user already exists in database the rest of the form will be auto completed and disabled to prevent changes but if passport dont exist then you have to enter all data.
There is two different ways to do this:
First you have your form, you develop an ajax function when you fill the first field (passport number) this ajax function do a request to your controller to search for a passport with that number if find something get data and fill others fields and turn them just readable, else just nothing and let user fill the fields by himself
second add a step-by-step where you first do a form to try find by pass number, user fill this only field with a number then submit, on submit this search for a record, if find fill the entire next step fields, else the next step will be the rest of form with the fields to be filled.
This may help you too: https://book.cakephp.org/3.0/en/orm/validation.html
Tell me how you decided to do :)

Concurrent update on record in Salesforce

In system I am developing, user can access particular page which is used to make DML operation on custom object. I want to fulfill following business case :
User A opens a Page made changes on page but did not click Save.
At the same time User B opens a page made changes and click Save. User B data got saved in record.
Now user A came and click Save. But as data is outdated I want to prompt user that "you are over righting the latest update. Do you want to continue."
Is there any faster out-of-box way available to achieve it ?
Assuming this is in a VisualForce page, you could check if the value has changed inside your Save method.
Query for the LastModifiedDate of all records you may change, and save that in your controller. This should be done in your controller's constructor and/or anywhere you re-load the record(s).
In the save method, first query the record(s) again to check if the LastModifiedDate has been changed. If it has been changed, prompt the user.
Assuming you are trying to insert a record into an object.
You can write a validation rule on that object. Check if that record is already inserted or not and show an error message.
Regards,
Naveen
autorabit

Best way to populate a dropdown sitewide that is

I am using CakePHP 1.3 and a layout which includes a dropdown of organizations a user has access to administer, so I'm trying to populate that dropdown with organizations that contain the userid that is logged in, but I want to populate it before the user sees anything so they can use it in the header. The dropdown needs to appear on every page once logged in. I tried adding the query to pull these organizations in the appcontroller, but userid was not yet available to use in before filter. Where or how should I do this? Should it be in session or is there a better construct to use? Element?
In my app it's no problem to use the user_id from within the beforeRender (if you are using the Auth-Component).
You can use it with $this->Auth->user('id').
I would do it like this: Check in the AppController if the user is logged in. If he is, pull your wanted information from the database (or whereever you get your information from) and store it in a variable called $dropdown for example.
If the user is not logged in, $dropdown will be false.
You now make this variable available to the view with $this->set(compact('dropdown'))
Now in your layout (this is important to you have it on every page) you can easily do a check if $dropdown is false or not. If not, you can work with your variable and show the user your wanted dropdown.

Secure Menu Items Based on User

On this winform application I am writing, I want to secure one menu item from most users. It runs a month-end and cannot be easily backed out if accidentally run. The menu option opens up a window to prompt the user for some information before processing. I don't care where exactly I do the check, but I want to be sure only certain users can run this function.
A Google search (on my question title above) didn't turn up anything obvious. Can anyone point me in a direction to pick up who is signed into Windows and how to check if they are authorized?
This page has some code for getting user details and checking them.
This code:
public string GetloggedinUserName()
{
System.Security.Principal.WindowsIdentity currentUser =
System.Security.Principal.WindowsIdentity.GetCurrent();
return currentUser.Name;
}
returns the current user name. You could use this to check against your list of authorised users.
More details on the WindowsIdentityclass can be found here.
It has a Groups property which you could use to check for membership of a group rather than having to check individual users.

Resources