Monday, December 2, 2013

Parent & Child items in SharePoint 2010 OOTB through SPD

Requirement.

many times we get requirement to create child items for the mail parent list item, for example. you have issues [Parent list] and you want to logs to those issues [Child list]

This blog is for one of the person who took my interview [MindTree Ltd] and by my answers he was surprised and could not able to believe my solution. I told it is possible through OOTB with nice UI but he was confused and could not able to believe.

he estimated it may take 2 to 3 weeks to do it. but I achieved within 6 hours.

I will put snap shots first and the code how I did.

Create Parent Item: [ note: I m not hiding SP default buttons so that people don’t confuse how I did it]

in parent list I have just Title, I have provided Save and continue button, until we create parent. we cannot create child Smile

image

<input type="button"  value="Save and Continue" name="btnSave" class="ms-ButtonHeightWidth"/>

 

$(document).ready(function() {
$('input[name="btnSave"]').click(function(){CreateNewItem();});
});

function CreateNewItem()
{
debugger;
var tit = $('input[title="Title"]').val();

$().SPServices({
operation: "UpdateListItems",
async: false,
batchCmd: "New",
listName: "Parent List",
valuepairs: [["Title", tit]],
completefunc: function (xData, Status) {

var newID = $(xData.responseXML).find("z\\:row").attr("ows_ID");
if(newID == null || newID*1<1)
{
alert("\nThere was an error in creating item.");
return;
}
else
{
window.location = "editparent.aspx?ID="+newID;
}
}
});

}
</script>

 


after saving the parent I am shifting the page from new form to edit form of same item, parents save and cancel button I am not hiding.]


image





 


note:  I have added 2 save function, two way you can save the item

function Save()
{
debugger;
saveStatus=true;
preSaveStatus=true;

var buttonName = $("input[id$='diidIOSaveItem']")[0].name;
if (!PreSaveItem())
return false;
WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(buttonName, "", true, "", "", false, true));
}



I have added a button called create child entry. which pop ups child’s newform and after saving that item come below the edit form of parent. below create child button I have list view there I filter with parent ID ie id of the parent I am storing it in every child, I am sending this parent ID through query string


http://<server>/sites/PST/Guru%20RnD/Lists/Child%20List/newChild.aspx?ParentQSID=22&IsDlg=1


image


once you save I have refresh the parent page so this item get filtered in the below list view


image


 

 <input type="button" class="ms-ButtonHeightWidth" value="Create a new Child Entry..." onclick="CreateChild();"/>

this code in parent edit form.

function CreateChild()
{
var parentID = getParameterByName("ID");
//Using a generic object.
var options = {
title: "My Dialog Title",
width: 800,
height: 600,
url: "../../Lists/Child%20List/newChild.aspx?ParentQSID="+parentID,
dialogReturnValueCallback: function(dialogResult)
{
SP.UI.ModalDialog.RefreshPage(dialogResult)
}
};


SP.UI.ModalDialog.showModalDialog(options);

}

CHILD NEW FORM


I am setting parent id in child through SPD designer

<asp:Textbox runat="server" id="ff2{$Pos}" text="{$varParentID}" ControlMode="New" FieldName="ParentID" __designer:bind="{ddwrt:DataBind('i',concat('ff2',$Pos),'Text','TextChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@ParentID')}"/>                            

image


image




 


Tuesday, November 5, 2013

Attachment & files [pdf, zip] are not prompting to Open in SharePoint 2010, only saved, not opening OR [file does not show open]

one of my customer raised a issue regarding file does not prompt to open the files in SharePoint site, mostly pdf and zip files

image

yes it is a issue, if files does not opens why to maintain database. !!

The Solution

It is a simple web application setting ,The setting is called Browser File Handling and can be found in the General Settings of the web application.

CA> webapplication> general settings> Browser file handling > make it to Permissive

image

problem solved !! if you read a blog don’t forget to comment plzz

image

Monday, October 14, 2013

Showing different values in SharePoint all item views in only in view based on configuration list [currency, Exchange date] defined

 

Create two list,

Requirement:

I have 1 list with key | Exchange Rate  two columns

List 1:

key

Exchange Rate

A

0.5

B

2

C

2

D

3

>>>>>>>>>

List 2: another list Amount List Key Amount

key

Amount

A 1000

1000

A 2000

2000

B 3000

3000

whenever users open any particular view (example test.apsx) of second list ( customized in SPD)

I have to get below results depending upon the exchange rate defined in configuration list 1

I,e exchange rate * Amount

key

Amount

A

500

A

1000

B

6000

 

Report has been implemented in my test site, follow the process to do it. Make you’re your configuration list currency will be look up with

clip_image001

multiplied value

1) Select your column to multiple in any newly created new, select formula on the top

2)

clip_image001[8]

3) Multiply the value with the current node as per the snap shot

4)

clip_image003

image

Showing different values in SharePoint all item views in only in view based on configuration list [currency, Exchange date] defined

 

Create two list,

Requirement:

I have 1 list with key | Exchange Rate  two columns

List 1:

key

Exchange Rate

A

0.5

B

2

C

2

D

3

>>>>>>>>>

List 2: another list Amount List Key Amount

key

Amount

A 1000

1000

A 2000

2000

B 3000

3000

whenever users open any particular view (example test.apsx) of second list ( customized in SPD)

I have to get below results depending upon the exchange rate defined in configuration list 1

I,e exchange rate * Amount

key

Amount

A

500

A

1000

B

6000

 

Report has been implemented in my test site, follow the process to do it. Make you’re your configuration list currency will be look up with

clip_image001

multiplied value

1) Select your column to multiple in any newly created new, select formula on the top

2)

clip_image001[8]

3) Multiply the value with the current node as per the snap shot

4)

clip_image003

image

Thursday, October 10, 2013

What I miss about you [Katie Melua], version 2 by me

 

Its a try !! don’t know how you all feel another version of this song, suggestion and corrections are always welcome.

Missing the talk every night at 8.52

Forgetting myself in our talks as you do

The sharing of feelings that no one else knew

That’s what I miss about you

 

The every smile of yours made me mad

Your starring eyes, melting in my smile told everything

How every day you used to care me

That’s what I miss about you

 

Your presence in my boring life, exciting me

Driving in your dream every day, that was free

Gearing up the imagination, laughing for nothing free zed me

You made me feel you’re mine, like fruits for tree

 

The way you tried to separate the parasite

Your habit of stubborn ever never stopped

The way you said, I am not your bite

Pushing me like thorn of life which you chewed

That's what I don't miss about you

 

I bet you're lying wearing the hating mask

Spoiling the life with your own rules

Expecting me to forget our entire task

Knowing we are in a two different poles

 

The way I doubted believing others was wrong

This is one way of loving for few

The moment you are here, hearts beat prolong

Your skill of putting me down in a flash of flew

That’s what I don't miss about you

Friday, August 30, 2013

Populating the data to drop down list from another list without creating lookup column

Populating the data to drop down list from another list without creating lookup column

WHY??

few scenarios, when you have a look up column, if you delete the item from the look up, users cannot see the that item’s value where they have used in while creating

this leads to retain the column values, also if you delete or add any items in Country (source list) the reflect in the target list where we are looking up

OUR testers tested this scenario to solve this issue I proceeded with below approach

1) Create a list

2) add a choice or single line text column to the list, in my case country

3) Open the list in SharePoint designer

4) create a new form for your list

5) you will get a web part having all the columns in the page

6) your created  choice column will look like below

 

<SharePoint:FormField runat="server" id="ff25{$Pos}" ControlMode="New" FieldName="Country" __designer:bind="{ddwrt:DataBind('i',concat('ff25',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Country')}"/>


7) create a another row through designer.

8) Insert data source from the ribbon. select your source list


insertdatasource

<td class="ms-formlabel">
<SharePoint:SPDataSource runat="server" DataSourceMode="List" UseInternalName="true" UseServerDataFormat="true" selectcommand="&lt;View&gt;&lt;/View&gt;" id="spdatasource1">
<SelectParameters><asp:parameter Name="ListID" DefaultValue="7587B054-1CB0-4AF3-B419-1023C67EA93F" /></SelectParameters>
<DeleteParameters><asp:parameter Name="ListID" DefaultValue="7587B054-1CB0-4AF3-B419-1023C67EA93F" /></DeleteParameters>
<UpdateParameters><asp:parameter Name="ListID" DefaultValue="7587B054-1CB0-4AF3-B419-1023C67EA93F" /></UpdateParameters>
<InsertParameters><asp:parameter Name="ListID" DefaultValue="7587B054-1CB0-4AF3-B419-1023C67EA93F" /></InsertParameters>
</SharePoint:SPDataSource>
</td>


<SharePoint:DVDropDownList Width="175px" runat="server" id="ff25{$Pos}" __designer:bind="{ddwrt:DataBind('i',concat('ff25',$Pos),'SelectedValue','SelectedIndexChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@ResourceName')}" Width="76px" selectedvalue="{@ResourceName}" datasourceid="spdatasource1" datatextfield="Title" datavaluefield="Title" />



9) change your FORMFIELD to above control,


10) Done


Populating the data to drop down list from another list without creating lookup column

Populating the data to drop down list from another list without creating lookup column

WHY??

few scenarios, when you have a look up column, if you delete the item from the look up, users cannot see the that item’s value where they have used in while creating

this leads to retain the column values, also if you delete or add any items in Country (source list) the reflect in the target list where we are looking up

OUR testers tested this scenario to solve this issue I proceeded with below approach

1) Create a list

2) add a choice or single line text column to the list, in my case country

3) Open the list in SharePoint designer

4) create a new form for your list

5) you will get a web part having all the columns in the page

6) your created  choice column will look like below

 

<SharePoint:FormField runat="server" id="ff25{$Pos}" ControlMode="New" FieldName="Country" __designer:bind="{ddwrt:DataBind('i',concat('ff25',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Country')}"/>


7) create a another row through designer.


8) Insert data source from the ribbon. select your source list


insertdatasource

<td class="ms-formlabel">
<SharePoint:SPDataSource runat="server" DataSourceMode="List" UseInternalName="true" UseServerDataFormat="true" selectcommand="&lt;View&gt;&lt;/View&gt;" id="spdatasource1">
<SelectParameters><asp:parameter Name="ListID" DefaultValue="7587B054-1CB0-4AF3-B419-1023C67EA93F" /></SelectParameters>
<DeleteParameters><asp:parameter Name="ListID" DefaultValue="7587B054-1CB0-4AF3-B419-1023C67EA93F" /></DeleteParameters>
<UpdateParameters><asp:parameter Name="ListID" DefaultValue="7587B054-1CB0-4AF3-B419-1023C67EA93F" /></UpdateParameters>
<InsertParameters><asp:parameter Name="ListID" DefaultValue="7587B054-1CB0-4AF3-B419-1023C67EA93F" /></InsertParameters>
</SharePoint:SPDataSource>
</td>


<SharePoint:DVDropDownList Width="175px" runat="server" id="ff25{$Pos}" __designer:bind="{ddwrt:DataBind('i',concat('ff25',$Pos),'SelectedValue','SelectedIndexChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@ResourceName')}" Width="76px" selectedvalue="{@ResourceName}" datasourceid="spdatasource1" datatextfield="Title" datavaluefield="Title" />



9) change your FORMFIELD to above control,


10) Done

Thursday, May 16, 2013

retaining the values of lookup column after deleting the item from the look up list in SharePoint 2010

Hi Friends,

there is interesting requirement came when people started testing on some of the OOTB application, we usually develop rapid OOTB application in SharePoint 2010. One of our tester is started testing the application, he was deleting the items from the look up column and customer wanted to retain those values it the list so that they can identify what was the value previously

this can be achieved in two way

one InfoPath

1) if you are designing the form in in InfoPath, instead of look up column, create a single line text,

2) make that as drop down

3) then bring the data from the other list and on the form load bind the data.

4) so item stored the date in a single value but user can select the data from the looked up list

through SPD

1) removed the form field from where you are looking the data from the newform.aspx

2) create SPDROPDOWN control rename the IDs and all the data as per the FORM FIELDS

3) create a connection for the look up table ( you can filter also in connection like active lookup values)

4) add this connection data to SPDROPDOWN

5) save the file. it works as expected

 

Sorry I am not putting any snapshot. if anybody wants i can put those things.

thank you. happy coding OOTB