How to write a Trigger on Knowledge Base Article? - salesforce

I need to create a Trigger on Knowledge Base Article, but it may seem impossible?

Classic SF or Lighting? Knowledge in both seems to work differently, see https://help.salesforce.com/articleView?id=knowledge_compare_classic_lightning.htm&type=5.
I don't have an org with Knowledge enabled handy, can't check...
You might not be able to put a trigger on the generic KnowledgeArticleVersion but should be possible to do it on your custom FAQ__kav or what have you. See also https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_knowledge_considerations.htm and https://success.salesforce.com/ideaView?id=08730000000jVKGAA2

Related

Change HP Fortify C rule priority

I was wondering if anyone had any information on how to change a priority on a rule in HP Fortify?
For example in C, the category "Uninitialized Variables" has the fortify priority order of LOW. I need to change to HIGH for auditing purposes. Is there any way to change a rule or do I need to create a new rule?
If I need to create a new rule, how would I make a rule that matches "Uninitialized Variables" and make it global for other users to use?
There's not really way for you to modify the existing rule pack. But that's okay. There's something much easier that I can suggest that does not involve trying to create or modify custom rules (which can get a very messy if you're not careful).
The easiest thing you can do is create a custom Folder Filter.
Open up your FPR in Audit Workbench. Select the correct Filter Set that you normally use.
Your chosen Filter Set will be home to
our new Visibility Filter. For example purposes I will use the Security Auditor View. Then select the Filters tab and click Create New Filter.
Use the values shown below, but feel free to adjust if needed, and then click Save:
At this point, you should be able to see the Uninitialized Variable findings in the High tab.
SPECIAL CONSIDERATIONS:
This change to the organization of your Fortify Findings right now, only is in effect for this one FPR. If you wish to have this filter rule exist in scan for other projects, then you will need to modify the default fortify filters be creating something called a custom Fortify Issue Template. Check your fortify documentation to get more information on this.
If you try to upload this to SSC (Software Security Center) where you might want to perform some reporting, then the default Issue Template that lives on SSC will be used to sort and organize your scan's issues, when generating reports. If you wish for your new custom Fortify Issue Template to be used for reporting and organization withing the web UI, then you will need to override the default Issue Template on the SSC server with your new custom Issue Template. Again, see your documentation for more information on this.
Finally, there is a way to potentially create a custom Fortify Control Flow rule (which will need to be used, together in combination, with a suppression rule) that will make it possible to essentially reassign the priority metadata for your particular issue, but this is quite difficult.

Implementing a protocol version in my code

I am writing an application which will be used for event sending. As it stands right now the application is done, however in the future there will be additions to the application. Those additions will be new versions. My question is how to actually implement those version. Sure I can go for "if version == xx" but doing that in every method, in constructors, just does not seem as the exact solution, that's why I am asking for help from people with experience in implementing those versions. Thanks!
The problem you are facing can be handled with implementing forward compatibility. Unfortunately, I cannot give you any practical advice without knowing anything about your protocol. There are some general steps you could follow, though:
Only change the protocol if you really have to.
Ensure you do not break backward compatibility.
Force the user to update the application when update the protocol. This ensures there is only one valid version at a time.
If you have to support multiple versions of the protocol you could implement some kind of converter. But this might not work in every case.
I'll deal the problem with Interfaces and Factory pattern.
For example:
Create an Interface with all the methods.
Create differents implementations for each version.
Use Factory to get the proper implementation

CakePHP ACL Auth Trouble

I love CakePHP, but cannot wrap my head around the ACL/Auth subject. Everything else comes together nicely, but when it comes to this, I am lost. On top of it, I cannot finish my application if this is not solved. Therefore, I desperately need your help.
Things to note:
I have tried a few of the plugins available, but to no avail.
I have used tutorials online as well as the latest CakePHP book by Mariano, with no success.
I have tried on my own, also to no avail
Why is it so hard to get this accomplished?
These are my questions:
Is there any other way to handle Access Rights in a CakePHP application with Multiple Admin, users, etc?
For the possibility that ACL is the only/best way, how else could I approach this?
What could I possibly be doing wrong?
As you say that you have already tried a few of the available plugins, you have maybe already tried my own one: http://www.alaxos.net/blaxos/pages/view/plugin_acl It is mainly a graphical interface that allows to set the ACL permissions when they are used to grant/deny access to actions.
My point here is that in addition to the plugin itself, I made available a very simple sample application http://www.alaxos.net/blaxos/pages/view/demo_plugins that uses this plugin. It may help you if you install it and look at the code, as the application has some public parts, and some parts protected by the ACLComponent.
This is one of the pains in Cake, the complexity of ACL..
Is there any other way? Well, yes. Yes, in the sense that you can cook up your own access rights management, and simply go around the cake's ACL implementation. For example, you could have a role based ACL where roles would be pretty much a fixed list. This can be accomplished in many ways, one of which was demonstrated with DarkAuth.
Further more, don't try to fit your app into the cake's ACL scheme if it doesn't suit you. Bake your own, cake offers you the option of plugging in your own objects for auth/ACL stuff, so use it!
But do note that any feature-rich ACL system you want to create yourself might end up looking much like cake's ACL..so first decide exactly what you need, and then look for a way to do it.
In any case, good luck!
I just recently wrote the probably most simple Auth - I called it "Tiny":
http://www.dereuromark.de/2011/12/18/tinyauth-the-fastest-and-easiest-authorization-for-cake2/
It should be just about what you need.
It does need the roles to be present in the Session Auth, though and that you manage user roles yourself.
So you might have to add this to your login method if you want to use multi role Auth.

Can we create table for wordpress?

I am very new to wordress. I have a appointment form. While submitting a form i need to save those information from the form to the database. I created a table of my own lets say wp_appointment and saved the information to this table. Now what i want to know is that is this a good way to do so or is there any solution to this. And i need to display those information in admin section and update. Is it possible? Please do suggest me if i can do or not.
Thanks in advance
Now what i want to know is that is
this a good way to do so or is there
any solution to this.
Yes, this is the ideal way to doing this. Besides, there is something to consider:
For ease of use and compatability, you can use wordpress's built-in database functions. Check this one: wpdb Class
And i need to display those
information in admin section and
update. Is it possible?
Sure. You can create a custom admin page and show/make editable them in there. As a start point check this link: Adding Administration Menus. You can apply the instructions told there to your function.php file to have custom pages without create an "external plugin".
To answer your questions: Yes, it's possible. And what you described is being done by current calendar plugins.
Here is one:
http://wordpress.org/extend/plugins/events-calendar/
I would take a look at their code to see how they implement something similar to your idea.

What pattern to use in this scenario?

We have got many forms(windows app C#) in our application.We have similar steps in most of them - user adds a new object(in a grid),fills values and save.On,save,we validate,and save if everything ok,else show message.Now,adding of object usually means we add a new row with some default values.
Your question is very broad, so I will answer with an equally broad answer:
You should use a pattern such as MVC or MVVM. You probably want to consider throwing in some of the concepts from DDD such as the repository pattern too.
Is this just a data-entry application? Is it really? Reeeaaally??? Are the validation rules very simple and tend to only be things like "is not empty" and "is in range"? Is there not much domain to speak of? Do you not have to integrate with other applications? Are you not really going to interact with any of this data except for reporting purposes?
If the answer to all this is yes then some sort of template pattern might be for you. Base each form on a base class. The base class has a save method. When you save it it can scan the form for all the controls on it, run any of the more obvious validations (less obvious ones can be stored as attributes) and save a database using conventions (or however else you want to do it).
Then again, if it truly is a data-entry application, why even bother to do it in Windows Forms? Slap it together with an Access DB and be done in a tenth of the time.
On the other hand, if you've got an actual domain then your application is not just a bunch of forms is it? The forms are just a way of issuing commands against a domain - and that's the real meat of what you were hired to do. In that case you should go read the big blue book.
So...yeah.

Resources