Posts Tagged ‘Sharepoint2010’

Recursive rules in InfoPath–How to prevent

September 24, 2013 Leave a comment


A while ago I had a scenario in an InfoPath form where the user could either enter an amount or a percentage value. This value would then get added to a total already in the form. The requirement is that the user enters either value and the form then calculates the other one.

So if I enter a number then the percentage gets calculated. If I entered the percentage then the number value gets calculated.

So I quickly setup some rules so that when the value changed the percentage or the whole numbers gets calculated and updates the relevant field. This creates a loop of continually updated fields.


I had hoped that some clever InfoPath “stuff” would just make this work and I wouldn’t have to worry about the issue. This didn’t work and caused the form to fail or the fields would not update correctly.


The solution to this problem is that you need a third field to control the updates. Mine is called “Calculating” and is a simple Boolean field.


Now in the rules for Field1 (number) and Field2 (percentage) the first thing to do is to check that calculating = 0 then set calculating = 1 and then set your field. At the end set Calculating back to 0.


This is just a very simple implementation of a lock but it stops the InfoPath rules going crazy.



Pictures explain everything

Categories: work Tags: ,

Getting changed field values from SPItemEventReceiver

November 26, 2012 1 comment

has written a very interesting looking helper function for getting old values out of events.

Categories: work Tags:

How to hide the SharePoint ribbon

November 23, 2012 1 comment


Here is a quick post to show you how you can hide the SharePoint ribbon on a page using JavaScript. This was created by one of my colleagues so I am not sure of why the ribbon needed to be hidden but here is how.


function hideEditRibbon() {
var ribbon = SP.Ribbon.PageManager.get_instance().get_ribbon();
// Set the tab to the “Browse” tab
SelectRibbonTab("Ribbon.Read", true);
// Remove the “Edit” tab from a list from from the ribbon.

SP.SOD.executeOrDelayUntilScriptLoaded(function() {

var pm = SP.Ribbon.PageManager.get_instance();

pm.add_ribbonInited(function() {

var ribbon = null;
try {
ribbon = pm.get_ribbon();
catch (e) { }

if (!ribbon) {
if (typeof(_ribbonStartInit) == "function")
_ribbonStartInit(_ribbon.initialTabId, false, null);
else {


Just add this code to a page using the content editor web part and it will work.

Categories: CPS, work Tags: , ,

Error when accessing ServiceJobDefinitions.aspx page from Central Admin

August 24, 2012 2 comments


So i went to manage a timer job and was presented with the following screen.



The ULS logs didn’t reveal too much information other than a nullreference exception.

There is however some more information in the widows application event log

There was an exception loading job definition "Microsoft.Office.Project.Server.Administration.ServerScheduledTimerJob" (id "48a2075b-37ac-4866-b498-997374621326"). Object reference not set to an instance of an object.





To fix the issue some PowerShell is needed to remove the job.


Run the following PowerShell script

$job = Get-SPTimerJob <guid of job>


The job definitions pages now loads Smile

Categories: CPS, work Tags: ,

Adding menus to site settings and central admin

March 20, 2012 Leave a comment
Categories: work Tags: