Tweak for SharePoint – Out of Box Tips and Tricks

1. Filtering lookup column in Parent List from child list

In child list, create a calculated filed call it “lookuptitle” with this formula  =IF([Status]=”Active”, [Title], “”).   Then in Parent list, have your lookup coulumn to get data from “child list” and coulumn “lookuptitle”

Good Luck…

2. Based on user sharepoint group permission need to hide the section in InfoPath SP list form

Every InfoPath section control render in html as fieldset tag,

Steps

  1. Add tooltip for the section control, it render as title attribiute
  2. Add a content editor webpart in list editform.
  3. below code get the user permission based on the group and hide the section identify the section using title attribute value

<script type=”text/ecmascript” language=”ecmascript”>
function IsCurrentUserMemberOfGroup()
{
             var grpName=”Application Packaging Requests Members”;
             var userInGroup;
        var currentContext = new SP.ClientContext.get_current();
        var currentWeb = currentContext.get_web();

        var currentUser = currentContext.get_web().get_currentUser();
        currentContext.load(currentUser);

        var allGroups = currentWeb.get_siteGroups();
        currentContext.load(allGroups);

        var group = allGroups.getByName(grpName);
        currentContext.load(group);

        var groupUsers = group.get_users();
        currentContext.load(groupUsers);

        currentContext.executeQueryAsync(OnSuccess, OnFailure);

        function OnSuccess(sender, args)
         {

            var groupUserEnumerator = groupUsers.getEnumerator();
            while (groupUserEnumerator.moveNext())
            {
                var groupUser = groupUserEnumerator.get_current();
                if (groupUser.get_id() == currentUser.get_id())
                {
                    userInGroup = true;
                    break;
                }
            }
            if (userInGroup)
            {
                //alert(“user exists in the group”);
               
            }

            else
            {
                $(“[title=’Administration’]”).css(“display”, “none”);
            }
           
        }

        function OnFailure(sender, args)
         {

        }
    }
$( document ).ready(function(){
 ExecuteOrDelayUntilScriptLoaded(IsCurrentUserMemberOfGroup, “sp.js”);

});
</script>