Trigger validation based on save button acumatica - customization

I'm considering using action save on a form , say customer file , to enable a pop up warning message. For example if the user hasn't filled in a certain attribute field depending on the customer class a warning message box will provide an alert. Using save button as the trigger .. Is it a good option, will there be any potential issues if acumatica change the code around save button defaults?
Thanks

As Gabriel mentioned you should review the developer training to get the best answer. Even more so on how to use AEF to write the customization correctly to override a graph such as customer maintenance. I would use RowPersisting to validate during a save. The training material should assist in the best way to do this because you need to extend the current Customer_RowPersisting call with your additional checks. Look at the source for "Customer_RowPersisting" or just "_RowPersisting" for examples. I think T300 is the course that will help you with the PXOverrideAttribute

Related

Show custom field in comment/response interface (RT)

I've created a custom field in order to detail what person's answer I'm waiting for.
Just an combo box that needs to apply to a ticket (queue or transaction doesn't work for me, because I need to filter the tickets using this field).
Now, I send a comment asking for something and I need to go all the way to the custom fields form to complete the field 'waiting for'. This is very tedious.
I would like to fill my custom field in the comment interface, under the ticket and transaction or message menu.
I've looked in RT documentation but I couldn't find anything similar (except changing the custom field to apply on transaction).
The "natural" way is to use the Jumbo link to update the whole ticket. Or you can install the CustomFieldsOnUpdate extension.

Sitecore Conditional Showing of Fields

So I am rather new to sitecore, and it's a topic that wasn't covered during my training. My questions is just to help point me to the correct term, or documentation on a method to do the following.
I have a definition item, with a ton of field groups, what I want to do is something like:
if Value of Field X is "yes" then collapse/hide Field X or Field Group X.
Does that make sense? Is it a validation rule? or some other kind of rules, is it a workflow I need to attach? Do you place it on just the field I want to hide, or the field that triggers the action?
I appreciate any guidance.
There is nothing out-of-the-box in Sitecore to achieve what you want but there is no reason you cannot create a composite custom field type to do this. The following articles will help you achieve this:
Creating a custom Sitecore Field
Getting to Know Sitecore: Custom Fields, Part 1
Create a new control, inheriting either from Droplist (if the comparison of the value is to be text based) or Droplink (for comparison of ID). You could add a parameter in the Source field of the control to specify what the values that trigger the hide should be.
The underlying control in the Content Editor is just a standard HTML select element. Add onchange events to the control and add your Javascript handler to hide the other controls. Since I could not find a way of adding additional custom css classes to the Sitecore controls, it would be best/easiest to hide all other controls in the same collapsible group after you control. This would mean you would need to group your controls better (or logically at least).
The Javascript will be something like this (the Content Editor uses the Prototype JS framework):
if ($(this).getValue() == 'no') {
// find the parent container of this control and then hide all the next siblings in the same group
$(this).up('.scEditorFieldMarker').nextSiblings('.scEditorFieldMarker').invoke('hide');
}
You can test this by running the above in the console, change out the keyword this with the id of your field, e.g. $('FIELD2292054').
What I am not sure about is how to trigger the hide on initial load, i.e. when someone returns to an existing item, it may be possible by adding to one of the pipelines, but would be better using a JS solution if possible. I'll have a think about this and get a proper code sample up over the next few days.
EDIT: You can add an event handler to sc:contenteditorupdated to handle the content editor being rel-oaded.
document.observe("sc:contenteditorupdated", myFunction);
I wrote up a blog post and put the code on GitHub if you are interested.
Not sure if you have come across Andy Uzick's this blog post.
He wisely talks about hiding fields in the Content Editor and has also created a Sitecore Module called Hide Field Template Extension which is hosted on the Sitecore Marketplace with the full source code to extend.
After reading through and trying the extension, I do feel that it will not completely resolve your issue (how you have described it in the question).
But it will give you:
A mid-term solution to hide a few unnecessary field that some content editors would not like to view.
Fields that are only required by administrators for admin purpose - to de-clutter these fields could be hidden.
Just one thing to bear in mind that it mentions in the requirements Sitecore 6.5 & 6.6. I have not tested it in Sitecore 7. If you are using Sitecore 7, which I think you are, one could modify the source code and make it work for Sitecore 7.
Have a look and share your findings.
Happy Sitecoring!

Email notifications for follow-up comments in Django's comments app

I'm using the stock Django comments framework. What's the best way to add a checkbox to the comment form to allow commenters to be notified of future comments?
This isn't built into the django comment framework so you have to do it yourself.
You could subclass the Comment model to include a boolean field that tracks whether or not the commenter want's to be notified on that comment, then wrap the post_comment view to detect this settings - for every new comment that is made, collect all the other comments for that object and create a list of the users that want to be notified, then use django-notifications or similar to actually send the notifictions.
On the frontend you simply need to overwrite the templates/comments/form.html to include your new field so that should be easy enough.
This is too high level to give any code samples, so you'll have to work on it yourself and come back when there are problems.

Are workflow comments customizable?

Does anyone know of any way to customise the Workflow Comments box that appears in Sitecore if you enable the "comments" option?
I'm looking to extend this a little ... but can't see this referenced in any sitecore javascript or shell files - I'm guessing I will need to build a custom dialog in its entirety to implement the functionality I want, but not 100% where to start!
We ended up putting a solution in place that, broadly, composes of a custom action, containing the relevant form that we need. The information that the user submitted was then parsed, and passed to the workflow as comments (this particular workflow command was hidden from users, so they had to go through our custom one).
Not ideal, but works!

How do I force new users to fill out their User: page when they create a new account on a MediaWiki wiki?

The unnecessary new user mistakes I'm having to revert on the wiki are getting annoying.. Is there any way for me to preload their User:Username with instructions on finding any help they may need and links to places to ask questions, further-more, is there any way to require new users to make three User:Username / User_talk:Username / User_talk:SomeAdmin page edits before editing other pages?
I don't know how to force it, but here is a trick I use:
Download and install the MyVariables extension.
Create a template to use it called {{User name}} - code below.
Include this template in a welcome message on your main page. The user will then see either Welcome <their name> if they have filled it in or Welcome enter your user name if they have not.
Two points on this template:
if they have not entered their name, the text links to a page explaining how to do that (you will need to create this),
if they have entered their name, the text links to MY PREFERENCES where they can update their user data.
Of course, you can change this if that is overkill.
The code:
{{#if:{{CURRENTUSERREALNAME}}|[[MY PREFERENCES|{{CURRENTUSERREALNAME}}]]|[[How to create your user profile on this wiki|enter your user name]]}}<noinclude>
<Add text here explaining the template, or just link to this stackoverflow page!>
[[Category:Template]]
</noinclude>
Another "trick" I've used is using the NewUserMessage extension to ask users to add this information.
Since I have no power to install/remove extensions on this wiki, I had to go with what I have. The wiki has Extension:InputBox installed.. So, I set up Template:Welcome, created a preload, and set up MediaWiki:Welcomecreation with a simple button that does most of the heavy lifting so to speak... It does not actually force anything, but gives all of the needed information and has a similar final output to what I was looking for.