Sharepoint Forum

 
Home » Forum » Sharepoint       Ask a questionRSS Feeds

Renaming an infopath document through a workflow

  Asked By: Noemi Ayers         Date: Jan 05, 2010      Category: Sharepoint      Views: 666
 

I have an infopath form that I want to rename within a workflow. I want the Name
of the document to include the SharePoint ID of the record. At the moment I am
taking the max ID from the list and adding one to it within the form, however
this is not working because the max ID is returned only for the records that the
user has permissions for and not the true max ID.
I have been able to modify a field in the form through the workflow but not the
actual name of the document.

Tagged:            

 

8 Answers Found

 
Answer #1       Answered By: Leeann Hull          Answered On: Jan 05, 2010       

What if you were to write a webservice method (or maybe even use an existing
one) to return the *true* max  ID?

 
Answer #2       Answered By: Vaasu Radhakrishna          Answered On: Jan 05, 2010       

Although I have no idea how I would call a web
service from within the InfoPath form.

This could, however, still result in problems if two users were to fill out
forms at the same time. They would both be given the same MAX ID. If I set this
after the form  has been saved there is no chance of a duplicate.

 
Answer #3       Answered By: Brinda Bca          Answered On: Jan 05, 2010       

Have you considered using an event handler for this?

 
Answer #4       Answered By: Sheryl Velez          Answered On: Jan 05, 2010       

I would have thought that an Event Handler will require the same sort of update
as I will be performing in a workflow. Both are updating the SharePoint ListItem
object.

I guess I could do it with the Inserting Event and try to modify  the name prior
to the save. I can then still use the workflow  to modify any fields if required
later in the process.

 
Answer #5       Answered By: Josephine Buchanan          Answered On: Jan 05, 2010       

Thought I'd put up the solution that I finally settled on.
The Event Handler (ItemAdding) did not work. I was not able to set the name of
the document  here. After some digging I came across a way to set the name in the
'ItemAdded' event, which could also be used within the workflow  so turns out I
found exactly what I wanted.
Here is the code:

string url = file.Url.ToString();

string newurl = url.Replace("XXX", formID);

//DisableEventFiring(); //Only required for the Event Handler
file.MoveTo(newurl);

// Save the changes made to the SPFile object
file.Update();

//EnableEventFiring(); //Only required for the Event Handler


Pretty simple once you know how.

Hope this helps someone else

 
Answer #6       Answered By: Alexandra Lewis          Answered On: Jan 05, 2010       

You can do with workflow  easily. Just in workflow build a dynamic string and
save as a parameter adding  the ID with whatever else you want the name to be and
then set field  in current item and select name (for use in forms) and set to
param.

 
Answer #7       Answered By: Himanta Barthakur          Answered On: Jan 05, 2010       

how have you been able to modify  a field  in the form  through the
workflow? Promoted fields, yes, others? Any blogs or pointers? I've never
seen/heard of this.

 
Answer #8       Answered By: Mansi Revenkar          Answered On: Jan 05, 2010       

I used this article to help me with the setting of a field.

www.bizsupportonline.net/.../set-infopath-form-field-value-share\
point-workflow.htm

There are a lot of good articles at this site relating to InfoPath.

 
Didn't find what you were looking for? Find more on Renaming an infopath document through a workflow Or get search suggestion and latest updates.


Your Answer
  • Answer should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].