Edit: I´m really sorry, the preformatted text works depending on something that I have not found yet…so, I´ll have to leave the code as it is for now.
You´re almost there, you just forgot a couple of things:
Unwrap the phase filter too, it is a Revit element as the view.
After the unwraping, you will have to use the transaction manager.
#enable Python support and load DesignScript library
import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *
clr.AddReference(‘RevitServices’)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference(‘RevitAPI’)
import Autodesk
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument
#the inputs to this node will be stored as a list in the IN variables.
view = UnwrapElement(IN[0])
phaseFilter = UnwrapElement(IN[1])
#place your code below this line
TransactionManager.Instance.EnsureInTransaction(doc)
view.get_Parameter(BuiltInParameter.VIEW_PHASE_FILTER).Set(phaseFilter.Id)
TransactionManager.Instance.TransactionTaskDone()