(MODx) How to set the default value of a resource setting? - modx

In the latest MODx (2.3.1) I'd like to make the 'Container' checkbox (system key isfolder) for a document resource checked by default.
How can this be accomplished?
Thanks.

In modx you can set a default field value in many ways. Possible via a plugin, but you can do it easy through form-customization ( http://rtfm.modx.com/revolution/2.x/administering-your-site/customizing-the-manager/form-customization-sets )
1. Go to Security --> Form Customization.
2. Create new profile and go edit him.
3. Inside profile create new "Set Rules" on "create resource" action,
live template blank if you do not have to limit on it.
4. Edit new set of rules and set inside property "isfolder" to 1.
5. Save and check how it works.

Within the system "you can't", what you will have to do is create a plugin that fires on one of the document save events, it's going to be a little complicated to implement but there is a discussion and some code examples here for you to follow.
http://forums.modx.com/thread/81774/automatically-tick-container-box-when-subpage

Related

Can a you restrict a Sharepoint user from editing a list item after adding it via a workflow?

We currently have a number of workflows in our organization that require users to add an item to a list via a form, but then not be able to edit that item unless given special permission to do so.
For example a user submits a leave of absence request and it is routed to their manager. The 1st level manager might approve this request and the workflow continues. While the request is in the managers hands it cannot be modified by the original submitter, however if the manager rejects it or requires revision the original submitter should then be able to edit.
Is this possible? The best strategy we could come up with for this is multiple Lists to handle the different levels of security required for this. Are there better ways of doing this?
SharePoint seems to have a very open concept of security within an SP site and maybe were just trying to fit a square peg in a round hole.
Thanks!
How about Remove permission for that user/for all user using workflow itself?
http://spcycle.blogspot.jp/2012/01/how-to-create-workflow-to-change-item.html
http://shareapointkiran.blogspot.jp/2012/06/addremove-permissions-using-sharepoint.html
And then give it back when manager approves/rejects
I had a similar problem and solved it with a quick and dirty solution.
In our case this quick and dirty solution might be even easier.
You could add a hidden field that has an default value of for example 0.
Then you add a (formating) rule to one of the fields that should be deactived.
The rule should deactivate the field if the value of the hidden field is not 0.
This rule can be copied to every field that should be deactivated too.
Now add a set field action to your workflow that set the value of the hidden field to something else than 0, for example 1.
To make a hidden field you can define formating rule with a condition that is always true.
Now if someone creates a form the workflow will set the value of your hidden field to 1. The rule of the fields that should be deactived will now deactivate the fields.
Hide the field
Deactivate the field rule

Need to set Default value in Kofax Capture Scan , Create Batch popup

I am using Kofax Capture scan 10.o
Requirement is to set the default value in Create batch window setting pages per batch to 20 instead of 0 everytime the user open this window.
Please let me know how this will be possible.
I am not aware of how to customize this window.
Thanks.
I don't believe it is possible to set this programmatically. However you could write a custom Scan panel that pops up a warning if a batch is trying to close without 20 pages. This would essentially do the same thing as the product functionality, but then the user doesn't have to enter the number each time.
To write a custom panel you would need to look into the Capture API documentation and the sample installed to CaptureSV\Source\Sample Projects\StdCust\OCXPanel.
Update:
Daniel is correct in saying that "Pages per batch" is not a batch field. It is a property of the batch that must be set on the Create Batch dialog. To my knowledge this cannot be set programmatically: I did not see a mention of it in the API guide.
Actual batch fields can have a default set as you can see in the Batch Class Properties dialog below. It can either be an explicit string or one of the curly brace auto replace values. And yes, you should be able to modify them programmatically from a workflow agent. Or if using KTM, enable foldering in the KTM project and then batch fields are mapped to the root folder and can be modified in KTM validation or from script in any KTM module.

How should I implement `OnLoad` event handler when creating an activity using a contact?

I've created my own solution with a custom entity of type activity. I'd like to show a message whenever a new instance of it is created using an existing contact but not allow the user to create one, if only attempting to do that without going via contact.
Basically, my aim is that it won't be impossible to just create that activity (the form will be hidden directly at any attempt except for one way only). The user will have to go to contacts (or leads etc.) and in there add and create an instance of the custom activity entity. That way, I can assure that the field "regarding" will be filled out already.
I'm guessing that I need to detect somehow that the opening of the form is a creation attempt. How can I do that?
Also, as it is now, the user can't create a contact-less activity of the custom type because it doesn't appear on the menu with other activities. I must have disabled it somehow but I have no idea how. Anybody who has one?
You could do this a bunch of ways but the easiest would probably be to:
Make the regarding field read only.
Make the regarding field mandatory.
That way if a user opens a create new form they wont be able to set the regarding and because its mandatory they wont be able to save the record. When they open via an existing contact the regarding field will be mapped automatically. That said in this case just making it mandatory my be enough.
(As a side JavaScript can be used to identify the current form state, but I'm not sure how useful that is here).
In terms of where custom activities appear, by default mine show in a number of locations, for example:
CRM > Workplace > Activities > Ribbon > Other Activities > XXX.
CRM > Workplace > Activities > View Selector > XXX.
They don't show under the left hand navigation of the workplace because they are grouped under 'Activities'. I'm pretty sure these are all the default settings.
You can exercise greater control by editing the sitemap, where you can put pretty much anything, anywhere.
In addition to Mr Wood, I'd like to show you some code. It works as supposed to but I'm not sure if it's optimal.
var foo = function () {
var whatIsGoingOn = Xrm.Page.ui.getFormType();
if (whatIsGoingOn === 1)
alert("Let there be an entity!");
else
alert("Not a creation...");
}
The other states' (deletion, update etc.) numeric values are listed here.
Answering the second part of your question:
When you create a custom activity you can choose whether to have it appear in 'normal' Activity menus or not by checking the box at the top right of the entity form. This is a once-only choice as far as I know and can't be changed later.
For your setup, I would suggest NOT checking this box, so it does not appear in the activity menus to avoid users even being tempted to do it that way.
Instead, add an explicit relationship to the activity N:1 to Contact, and another N:1 to Lead. Use this relationship to add your activity to the left navigation of Contact and Lead forms, or add a grid for them (depends on how you want to use this and if you need to filter the view to something other than the default "Associated View").
When a user navigates to this section they will see if any previous activities of this type exist, and be able to add a new one. BUT this means that the child record is a child via this relationship, not using "regarding", so use a script on the form for the activity so that if Contact is filled in, it is copied to Regarding, and if Lead is filled in then that is copied. If neither, then use an alert or other means to warn the use that something is wrong (see comment earlier). If you want Regarding to be read-only but filled in by script, you will need to make sure to use the force the value to be saved:
Xrm.Page.getAttribute("regardingobjectid").setSubmitMode("always");
You must have the lookups for Contact and Lead on the form to be able to use them in your scripts, but you can make them not "visible by default" so they are there but not seen by the user (and taking up no space).

Edit existing Profile Properties in sharepoint?

I have to edit Company Name profile property in SSP. It is not allowing me edit or delete property. I need to change length value from 250 to 50. How can I do that? Can we set through code?
Even if you can't delete the property, you should be able to hide it and create another one with the same display name.
If you have access to Sharepoint database, you can definitely do it directly there (which I do not recommend unless you're completely sure what you are doing).
Check if this property is mapped to an Active Directory property. If it is then go to AD manager and change the propertie's properties there :)

Is it possible to add new fields to the Summary Link Control

I am using the PublishingWebControls:SummaryLinkFieldControl and would like to add another field for the Group Description (In addition to the Group Name).
The default field available is the Group Name and Group Items. I really need an option to to hold the Group Description as well.
Is this possible without customisation?
You'll definitely need to customise to a certain extent!
I know you can create create new item screen by modifying CmsSlwpAddEditLink.aspx (search for it)
Though it seems like what you're after is modifying the creation of the Group.
Rough guess: Figure out which content type the list of fields is based on. Add your field in. Find the .aspx which fires when creating a new group (google it) , drop the field syntax into that and see if that works.
Let us know if you find a solution.

Resources