Dynamo / Python Script to retrieve parameter value from excel file and update parameter in door family

We have a Dynamo Script to extract values for a door type parameter from an excel file and update the door parameter in the model. We use a python node for updating the model. The below script works for the Built in parameter for the the Construction Type parameter. What would I need to change if I were to reference a shared parameter for doors called ‘Frame_Head’?

import clr

clr.AddReference(‘RevitServices’)
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import *

from System.Collections.Generic import List

clr.AddReference(‘RevitNodes’)
import Revit
clr.ImportExtensions(Revit.Elements)

def tolist(x):
if hasattr(x,‘iter’): return x
else : return
def getIndex(list, item):
i = 0
for s in list:
if s == item:
break
else:
i += 1
return i

doors = tolist(UnwrapElement(IN[0]))
marks = tolist(UnwrapElement(IN[1]))
check =

doorFilter = ListElement

with Transaction(doc) as t:

t.Start("Changing Keynote Value")

for c in doors:

	for a in doorFilter:
	
		if Element.Name.GetValue(a) == c:
		
			b = []
			
			b.append(Element.Name.GetValue(a))
			
			b.append(a.get_Parameter(BuiltInParameter.DOOR_CONSTRUCTION_TYPE).AsString())
			
			f = getIndex(doors, Element.Name.GetValue(a))
					
			a.get_Parameter(BuiltInParameter.DOOR_CONSTRUCTION_TYPE).Set(marks[f].ToString())
			
			b.append(a.get_Parameter(BuiltInParameter.DOOR_CONSTRUCTION_TYPE).AsString())
			
			check.append(b)
t.Commit()

OUT = check

check this out, Element.LookupParameter(string parameterName), when the parameter is not built-in.

https://www.revitapidocs.com/2019/4400b9f8-3787-0947-5113-2522ff5e5de2.htm

WIth the script below, I’m not receiving a warning that it can’t find the parameter. I’m receiving an error a warning for an unexpected token ‘f’ in the script. Did I not input the LookupParameter correctly? or what am I missing in defining ‘f’?

import clr

clr.AddReference(‘RevitServices’)
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import *

from System.Collections.Generic import List

clr.AddReference(‘RevitNodes’)
import Revit
clr.ImportExtensions(Revit.Elements)

def tolist(x):
if hasattr(x,‘iter’): return x
else : return
def getIndex(list, item):
i = 0
for s in list:
if s == item:
break
else:
i += 1
return i

doors = tolist(UnwrapElement(IN[0]))
marks = tolist(UnwrapElement(IN[1]))
check =

doorFilter = ListElement

with Transaction(doc) as t:

t.Start("Changing Keynote Value")

for c in doors:

	for a in doorFilter:
	
		if Element.Name.GetValue(a) == c:
		
			b = []
			
			b.append(Element.Name.GetValue(a))
			
			b.append(a.get_Parameter(Element.LookupParameter(String_FRAME_HEAD).ToString())
			
			f = getIndex(doors, Element.Name.GetValue(a))
					
			a.get_Parameter(Element.LookupParameter(String_FRAME_HEAD).Set(marks[f].ToString())
			
			b.append(a.get_Parameter(Element.LookupParameter(String_FRAME_HEAD).AsString())
			
			check.append(b)
t.Commit()

OUT = check