Tuesday 24 January 2017

Redirect to any other views or URL right after creation of an item in Sharepoint list new spform

//For redirecting
//Buton Save event
//this is only working if we use the default save button
//if we change the default save button to our custom button write these code on our custom buton event
fd.onsubmit(function() {
//Identify the typereg value
//Choice field or lookup field value
var typeRegValue=fd.field('Typereg').control()._el().find('select option:selected').text();
   if(typeregValue==Test)
   {
   //we can redirect to any list
     fd.sourceFormParam('/Lists/MyList/Test.aspx');
  
   }
   if(typeregValue==Test1)
   {
     fd.sourceFormParam('/Lists/MyList/Test1.aspx');
   }
   else
   {
     fd.sourceFormParam('/Lists/MyList/AllItems.aspx');
   }
    return true;
});

///
//If you want redirect to the edit form of the current saved item right after the creation
//Use below code
fd.onsubmit(function() {
  var uri = fd.setUrlParam(decodeURIComponent(window.location.href), 'FDRedirectWithID', 'fd_Item_Edit.aspx?ID=');
  fd.sourceFormParam(uri);
  return true;
});

How to get the Version History of Share point List items



select [WSS_Content_NEWSITE].[dbo].[AllUserData].tp_id, nvarchar1 as Title, float1 as ID, [WSS_Content_NEWSITE].[dbo].[AllUserData].tp_version as Version into temTab
from
          (
                   select [WSS_Content_NEWSITE].[dbo].[AllUserData].tp_id, min(tp_version) as Version, tp_listID
                   from [WSS_Content_NEWSITE].[dbo].[AllUserData]
                   Where AllUserData.tp_ListID = 'B390923C-EC6C-428E-9704-1244EAD0144F'
                   group by tp_id, tp_listid
          )
 as Sub inner join [WSS_Content_NEWSITE].[dbo].[AllUserData]  on AllUserData.tp_id = Sub.tp_id and Alluserdata.tp_version = Sub.Version and alluserdata.tp_Listid = sub.tp_listid


 Select * from temTab

'B390923C-EC6C-428E-9704-1244EAD0144F' is your list's GUID

Sunday 22 January 2017

Unable to find the default new or edit form for list/ document library in SharePoint



Do you have an error message when you try to open a SharePoint library, Edit ore view the properties of a file/folder? This is mostly like that somebody is messed with your forms , ie probably your forms become corrupted or deleted. This can break your entire SharePoint library. This is happening when some one is trying to move a SharePoint library to another one or working on document template forms. 

The error is something like that

  • Unable to find the default new form for list (listname)
  • Unable to find the default edit form for list (listname)

 
I will tell you how you can resolve this.

The basic and simplest method is



    Method 1

     

    Take back up and delete the existing EditForm of a doc library.

    For this
  1.  Open site in Sharepoint Designer 2013
  2.  Go to All Files

3.       Select the document library


4. Click 'Forms' folder





5. Keep the backup of EditForm.aspx

6. Delete the Editform.aspx

7. Then Got to 'lists and libraries' on left side links (Site Objects)

8. Select the library

9. On right side you can see 'Forms' tab.


 
10. Cleck 'New' link in there.
11. 'Create new list Item'  pop up will appear. Ente 'EditForm' in file name space.
 
 
12. In 'Select the type of form to create ' session , choose the radio button ' Edit item form ( Used to edit existing list items).
13. In advanced option ' Select the content type to use ' , select teh content type (Optional, Otherwise it will automatically choose the default one )
14. Refresh the page and try 'Edit Propereties' link on list item menu.
 

Method 2

 
Follow first 6 steps from Method 1
7. Now create a new .ASPX file and name it “EditForm.aspx”. and open it up in the editor.
 
8.  Now create a new library, and find the “EditForm.aspx” file in the new library and open it up. Copy over everything from the “EditForm.aspx” and copy it in the “EditForm.aspx” file you created in your broken library

9. The list Name and List id can be found in the “List and libraries” (see the image below). Also note the “Allitems.html” if this one is missing you can just recreate it using the “New” button.
10. Make sure that when you replace the List ID that you remove the curly brackets { }. As for the Title you can just fill in the name of your library. Now when you save the file in our case “EditForm.aspx” and when you did everything according to the above, it should be visible in “List and libraries” again.
11. Refresh the page and click edit prop    erties from list item, menu