SharePoint 2010 SPD Workflow copy list item to new list and designate the content type - sharepoint-2010

I have a functioning SPD workflow that copies the list item from list A to list B when the item in list A is marked approved.
My challenge is that list B has three content types to chose from. How do I designate which content type in list B to use when copying. I have a listbox that the user gets to choose what kind of a tool is being loaded. Some tools have required calibration dates and other tool specific items therefore the different content types.

I don't think you can specify the content type with Copy List Item - it should default to the default content type.
What I'd do instead is have my workflow Create List Item in List B, populating fields with values from Current Item. You can set Content Type ID by this process but it doesn't accept a variable, so use an If/Then block for each Tool type that only runs if that listbox value is selected.
Hope this helps!

Related

Script to extract and assign values from a nested JS object

I presently have a nested JS object of the format:
var oNames = {
Adobe:{LastUpdate:'03/09/2022',Website:'adobe.com',UserID:'jdoe#gmail.com',PWD:'1234567',PrimaryCC:'',SecondaryCC:'',PrimaryBank:'',SecondaryBank:'',SQ1:'First girlfriend',SA1:'Denise',SQ2:'Grade school attended',SA2:'OLPH',Notes1:'',Notes2:''},
Amazon:{LastUpdate:'10/06/2020',Website:'amazon.com',UserID:'jdoe#gmail.com',PWD:'1234567',PrimaryCC:'Discover',SecondaryCC:'Capital One',PrimaryBank:'',SecondaryBank:'',SQ1:'',SA1:'',SQ2:'',SA2:'',Notes1:'',Notes2:''},
AmericanGiant:{LastUpdate:'01/25/2022',Website:'american-giant.com',UserID:'jdoe#gmail.com',PWD:'1234567',PrimaryCC:'',SecondaryCC:'',PrimaryBank:'',SecondaryBank:'',SQ1:'',SA1:'',SQ2:'',SA2:'',Notes1:'Best Hoodies Made in the USA',Notes2:''},
Asus:{LastUpdate:'11/05/2022',Website:'https://www.asus.com/us/',UserID:'jdoe#gmail.com',PWD:'1234567',PrimaryCC:'',SecondaryCC:'',PrimaryBank:'',SecondaryBank:'',SQ1:'',SA1:'',SQ2:'',SA2:'',Notes1:'Goto for MB & Laptop Computers',Notes2:''},
.
.
.
]
Can someone please provide me with a sample script that loops through the object above to obtain the values for the properties in the object above associated with each name using the variable, cName, that derives its value from a selection made by an end user from a drop-down box form field that resides on a PDF form. In short, the value provided by the variable 'cName' will be one to match any one of the name values in the object, i.e., Adobe, Amazon, AmericanGiant, Asus in which event the remaining fields residing on the PDF form will be populated with those property values associated with the name selected. Hope this explanation is clear. Unfortunately, I am not as familiar working with object pairs as I am with arrays and as such am stuck creating a script that works with a nested object as provided above. Thank you ahead of time.
for(j=0;j<15;j++){
f=getField("inf."+j);
cName = oVendors[event.value][j];
}
"inf."+j denotes 1 of 15 PDF form fields to be populated from the values in the object associated
with the name in the object equal to 'cName', the name selected in the combo box that resides on the PDF form.
Upon further study of the JS object and its methods, the following script is
required to extract names stored inside a JS data object in a hidden text field
used to populate a drop-down box on the PDF form as follows:
dsFld =getField("dataSrc");// call getField method used to obtain the stored
data value in the hidden text field that resides on the PDF form
oVendors = JSON.parse(dsFld.value);// parse the JSON string to convert to a JS
object to complete tasks to follow
f = getField("cbNames");// call the getField method to get the
drop-down combo box field or later use
aNames=new Array();// create the temp array
for(var key in oVendors){// script to populate the temp array from names
taken from/stored in oVendors data object
aNames.push(key);
}
aNames.sort();// sort the names alphabetically in the temp array
f.setItems(aNames);// assign names from the array to the drop-down
Combo Box field on the PDF form
f.insertItemAt("Add or lookup and select a name");// Insert text item at
the topmost item provided in the drop-down combo box list
dsFld.value=JSON.stringify(oVendors);// convert JS obj back to a JSON
string value stored in the hidden text field
Sorry for the initial ambiguous post and any inconvenience to the forum.

How to display in Outlook, using VBA, a list of emails based on their EntryID (based on a list of EntryIDs stored in MS Access)

I have an Access DB that interacts with Outlook, including capturing the EntryID of selected emails as needed (which are stored in a table in Access)
I have code that allows users to view any email whose EntryID is stored, using Outlook's GetItemFromID method. This works as needed - it opens up a single email based on its EntryID.
However, what I am now looking to do is to filter the main Outlook window, to show emails based on a list of EntryIDs I have saved. So, for clarification, if I have a list of eg 3 emails (with their respective EntryIDs), the main Outlook window would be filtered to show those 3 emails. So basically like a search, but based on EntryIDs.
I can't seem to find anyway to do this? Perhaps there is a way to add a search filter via VBA that will search based on EntryIDs, but I can't find anything on this.
Any ideas much appreciated.
Binary properties like EntryID can't be used in any search or filtering operation in Outlook. You need to use any other properties (custom or user-defined ones) for filtering items in Outlook.
The View.Filter property value is a string, in DAV Searching and Locating (DASL) syntax, that represents the current filter for the view. For more information about using DASL syntax to filter items in a view, see Filtering Items.
Private Sub FilterViewToLastWeek()
Dim objView As View
' Obtain a View object reference to the current view.
Set objView = Application.ActiveExplorer.CurrentView
' Set a DASL filter string, using a DASL macro, to show
' only those items that were received last week.
objView.Filter = "%lastweek(""urn:schemas:httpmail:datereceived"")%"
' Save and apply the view.
objView.Save
objView.Apply
End Sub
Be aware, the EntryID value can be changed when items are moved between stores or folders. Moreover, the value is unique only per store.
If you need to show some items with specific EntryIDs strings you can get these item instances by using the GetItemFromID method and then marking them with a specific user property to be able to apply a filter for it. Or just add another string field to the Db with a custom value which can be added to items in Outlook, so you could easily apply a filter in the UI.

Syntax for SharePoint 2010 BCS URL Action to populate New form

Have seen several posts with solutions for native SharePoint lists, including the very useful SPUtility.js (only for native SharePoint lists). But nothing to pass a value from a BCS list to a new BCS list. The Query string filter will not connect on the New form (no web part to connect it to) and does me no good on the lists page (already have that working).
A "go write custom code for everything" is not a solution for me.
There should be a way to 1) pass the value in the URL (ideal - what's the syntax?) or 2) make some other simple change, perhaps to the select list for the item -- I just can't find it. Have seen quite a few posts with similar questions. The Microsoft documentation is not useful and there are more questions on the "social" topics than answers.
Here's what I have:
I have a BCS list (sends item) tied to a BCS related list (receives item).
I have an action on the related list (ECT) to create a new item. Works fine with no parameters. I get a blank new form. The new form allows me to enter two items and choose two items (exactly as intended).
What I would like to have is the necessary ?something=something string so that my user does not have to select one of the choice items (MNumber - set as a key / required value)
User selects "New" from Actions.
Form Opens
MNumber is automatically filled in based on the MNumber of the current item displayed in the BCS related list.
The string I supply is accepted. Does nothing.
/intake/Lists/ContactsList/NewForm.aspx
/intake/Lists/ContactsList/NewForm.aspx?MNumber=1234
The string I supply is rejected - cannot be saved or insufficient values.
/intake/Lists/ContactsList/NewForm.aspx?MHICNumber={$MHICNumber}
Have also tried passing a string to one of the text fields (instead of the select field). Can't get that to work either. I've spent quite a few hours with the various boards. Nothing helpful.
Would also be nicer if I could set the New form to display in a pop-over window (as it does when I select New from the list view). Opening a new browser window is hokey and replacing the existing one is a navigation pain for the user.
Have this working ... Thanks to Kit Menke!
Created an Action on the External Content Type in the BCS....
/intake/Lists/ContactsList/NewForm.aspx?IDnumber={0}&Source=/intake/scheduling.aspx
where
parameter property 0 is the IDNumber from the ECT
The NewForm.aspx was edited to add a hidden content editor web part with references to three scripts Kit wrote - two supporting and one that sets the values.
http://site/list/NewForm.aspx?toolpaneview=2
User selects the Action on the displayed ECT list
Action uses the URL to go to the New page with the data
Kit's script adds the data to the form and puts in the date and time.
Note: The ID field needs to be a text field. Cannot be a selection list.

Sharepoint 2010: Update Lookup Field Multiple Value with a Workflow

I want to update a lookup field that contains multiple values through a Workflow, using Sharepoint Designer 2010.
For the moment, the old value is always overwritten, and I would like to "merge" the old value with the new one.
Here is the list of my test by so far:
1) I've managed to Keep the old or the new one, but not both of them.
2) I've tried to add key words like : & ; , between the fields, but only the first element is written in the list ( Example : [%first Element: id%] ;[% Second Element: ID%] --> Result in the column : First Element Id)
I'm out of idea. Do you have any tips?
Do you need more information?
Is this possible to do such things in Sharepoint designer?
Yes this can be done in SharePoint Designer. You need to set both the ID and the lookup value (the text that is displayed in the lookup field) - and these need to be separated by ;#
Build the following as a string before setting it to the lookup value.
[%Current Item:LookupList%];#[%Variable:NewItemID%];#[%Variable:NewItemTitle%]
In the example above, the first item is your original multi-select lookup list. The second, is the ID from the item that you want to add to the lookup, and the third is the title (or the value you're displaying in the field) from the item you're adding.

Tracking item within a collection on WP7

I'm building a WP7 (VB.NET) app and have a custom class, PinInfo, of which I have two ObservableCollections, TempPins and FavoritePins.
In various parts of the app, I need a unique identifier to get a reference to a particular PinInfo in the collection, so at present, I assign an ID to the PinInfo when it's added to the collection, then later get a reference to the pin via the ID.
For example, if I create a button to delete a pin, I set its tag to the pin's ID, then the button click handler reads the button's tag to get the corresponding pin from the collection (via LINQ).
I generate the ID by adding one to the last-assigned ID, but these lists are often modified (i.e. items removed), so I end up with needlessly large ID numbers (e.g. just a few items, with IDs in the thousands).
How can I structure this better?
You could use a Guid instead of an integer ID.